title: Glue AWS: error occurred while calling o60.getDynamicFrame
body: <p>I have defined a basic script to create a DF with data coming from one of my tables in redshift. I run the process but I have been struggling for a while with a message that I'm not able to interpret.</p>
  
  <p><strong>The error output in the log is:</strong></p>
  
  <p><code>"/mnt/yarn/usercache/root/appcache/application_1525803778049_0004/container_1525803778049_0004_01_000001/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value py4j.protocol.Py4JJavaError: An error occurred while calling o60.getDynamicFrame. : java.lang.UnsupportedOperationException: empty.reduceLeft at scala.collection.</code></p>
  
  <pre><code>import sys
  from awsglue.transforms import *
  from awsglue.utils import getResolvedOptions
  from pyspark.context import SparkContext
  from awsglue.context import GlueContext
  from awsglue.dynamicframe import DynamicFrame, DynamicFrameReader, DynamicFrameWriter, DynamicFrameCollection
  from pyspark.sql.functions import lit
  from awsglue.job import Job
  
  sc = SparkContext()
  glueContext = GlueContext(sc)
  spark = glueContext.spark_session
  job = Job(glueContext)
  
  table = glueContext.create_dynamic_frame.from_options(connection_type="redshift", connection_options = 
      {"url": "jdbc:redshift://xxxxx.yyyyy.us-east-1.redshift.amazonaws.com:5439/db",
      "user": "yyyy",
      "password": "yyyyy",
      "dbtable": "schema.table_name",
      "redshiftTmpDir": "s3://aws-glue-temporary-accountnumber-us-east-1/"},
      format="orc", 
      transformation_ctx="table" )
  
  table.show()
  
  dfred = table.toDF().createOrReplaceTempView("table_df")
  
  job.commit()
  </code></pre>
  
  <p>Please I appreciate any help that you can offer me. Thanks so much</p>