By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Extract Transform & Load Data

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Large amount of time spent in "" in Spark/AWS Glue

Dear GlueCommunity, I'm using PySpark with AWS Glue for a large ETL job. Most of my source data sit in an AWS RDS Postgres instance. I read all my tables directly with `create_data_frame.from_catalog` because the logic is quite complex and implemented in pure PySpark, I don't use Dynamic Frames at all except when writing the final data back to S3. The first thing that puzzled me in the AWS Glue documentation was this part : > >**create_data_frame_from_catalog** > >create_data_frame_from_catalog(database, table_name, transformation_ctx = "", additional_options = {}) > >Returns a DataFrame that is created using information from a Data Catalog table. **Use this function only with AWS Glue streaming sources.** > Can someone explain to me why we are not supposed to use `create_data_frame_from_catalog` with non streaming-sources ? In my case none of my sources are streamed, so would it change anything to do instead `create_dynamic_frame_from_catalog().toDF()` ? However, my main problem is that one of my source data sits in S3 and is quite large (for my standards, 1To as gzip CSV). I configured the crawler and added the table into my glue database, the schema consists of only 3 columns. Everything seems in order for this table in my glue database. However, when I try & create a Data Frame for this table with `create_data_frame.from_catalog`, I get an additional Spark Stage which mostly consists of : ``` fromRDD at DynamicFrame.scala:320 org.apache.spark.sql.glue.util.SchemaUtils$.fromRDD(SchemaUtils.scala:74) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke( sun.reflect.DelegatingMethodAccessorImpl.invoke( java.lang.reflect.Method.invoke( py4j.reflection.MethodInvoker.invoke( py4j.reflection.ReflectionEngine.invoke( py4j.Gateway.invoke( py4j.commands.AbstractCommand.invokeMethod( py4j.commands.CallCommand.execute( ``` It's unclear to my why Recomputing the Schema would be necessary as the table with the schema is already incorported into my glue database and there is no reason to assume it has changed. At the moment with 5 G2.X workers, this step takes around 12 hours. After reading about the AWS Glue streaming sources and `create_data_frame.from_catalog`, I tried loading the dataframe with `create_dynamic_frame_from_catalog().toDF()` but this step of schema recomputing occured nevertheless. Does someone have any idea why recomputing the schema is necessary at that step? Could I force non recomputation in some way or another? A more general question would be, is there any other way to have this To of data accessed more efficiently than in S3 ? I don't want to put that in an AWS RDS instance because these data would be very infrequently accessed, should I be looking at something else, DynamoDB, etc ? Thanks a lot for your help,
asked 2 months ago