AWS GLUE - Big Query Connector Errors

0

I have issue in trying to set up custom query on glue studio for Big Query. For example, the query below works on BQ, but doesn't work on the custom query on glue studio.

SELECT * FROM `bigquery-public-data.covid19_italy.data_by_region` WHERE EXTRACT(YEAR FROM DATE ) = 2022;

However, if i change to BQ source to single table, then I can just pull the whole data. Overall, I am not interested in the whole data, and would like just to filter the require data I need. I even tried the simplest query (see below with/without back ticks)

SELECT * FROM `bigquery-public-data.covid19_italy.data_by_region` 

Why something so simple so difficult to achieve?

Py4JJavaError - An error occurred while calling o152.getSampleDynamicFrame. : java.lang.UnsupportedOperationException: empty.reduceLeft at scala.collection.TraversableOnce.reduceLeft(TraversableOnce.scala:179) at scala.collection.TraversableOnce.reduceLeft$(TraversableOnce.scala:177) at scala.collection.AbstractTraversable.reduceLeft(Traversable.scala:104) at scala.collection.TraversableOnce.reduce(TraversableOnce.scala:207) at scala.collection.TraversableOnce.reduce$(TraversableOnce.scala:207) at scala.collection.AbstractTraversable.reduce(Traversable.scala:104) at com.amazonaws.services.glue.SparkSQLDataSource.getPaths(DataSource.scala:755) at com.amazonaws.services.glue.SparkSQLDataSource.$anonfun$getSampleDynamicFrame$9(DataSource.scala:834) at com.amazonaws.services.glue.util.FileSchemeWrapper.$anonfun$executeWithQualifiedScheme$1(FileSchemeWrapper.scala:90) at com.amazonaws.services.glue.util.FileSchemeWrapper.executeWith(FileSchemeWrapper.scala:83) at com.amazonaws.services.glue.util.FileSchemeWrapper.executeWithQualifiedScheme(FileSchemeWrapper.scala:90) at com.amazonaws.services.glue.SparkSQLDataSource.getSampleDynamicFrame(DataSource.scala:828) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:750) Stack Trace Traceback (most recent call last):

File "/opt/amazon/lib/python3.6/site-packages/awsglue/context.py", line 281, in create_sample_dynamic_frame_from_options return source.getSampleFrame(num, **sample_options)

File "/opt/amazon/lib/python3.6/site-packages/awsglue/data_source.py", line 43, in getSampleFrame jframe = self._jsource.getSampleDynamicFrame(num, makeOptions(self._sql_ctx._sc, options))

File "/opt/amazon/spark/python/lib/py4j-0.10.9-src.zip/py4j/java_gateway.py", line 1305, in call answer, self.gateway_client, self.target_id, self.name)

File "/opt/amazon/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", line 111, in deco return f(*a, **kw)

File "/opt/amazon/spark/python/lib/py4j-0.10.9-src.zip/py4j/protocol.py", line 328, in get_return_value format(target_id, ".", name), value)

py4j.protocol.Py4JJavaError: An error occurred while calling o152.getSampleDynamicFrame. : java.lang.UnsupportedOperationException: empty.reduceLeft at scala.collection.TraversableOnce.reduceLeft(TraversableOnce.scala:179) at scala.collection.TraversableOnce.reduceLeft$(TraversableOnce.scala:177) at scala.collection.AbstractTraversable.reduceLeft(Traversable.scala:104) at scala.collection.TraversableOnce.reduce(TraversableOnce.scala:207) at scala.collection.TraversableOnce.reduce$(TraversableOnce.scala:207) at scala.collection.AbstractTraversable.reduce(Traversable.scala:104) at com.amazonaws.services.glue.SparkSQLDataSource.getPaths(DataSource.scala:755) at com.amazonaws.services.glue.SparkSQLDataSource.$anonfun$getSampleDynamicFrame$9(DataSource.scala:834) at com.amazonaws.services.glue.util.FileSchemeWrapper.$anonfun$executeWithQualifiedScheme$1(FileSchemeWrapper.scala:90) at com.amazonaws.services.glue.util.FileSchemeWrapper.executeWith(FileSchemeWrapper.scala:83) at com.amazonaws.services.glue.util.FileSchemeWrapper.executeWithQualifiedScheme(FileSchemeWrapper.scala:90) at com.amazonaws.services.glue.SparkSQLDataSource.getSampleDynamicFrame(DataSource.scala:828) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:750)

Error Category: UNCLASSIFIED_ERROR; An error occurred while calling o104.getSource. Error creating destination table using the following query: [SELECT * FROM bigquery-public-data.covid19_italy.data_by_region

T
asked 5 months ago72 views
1 Answer
0

Hi, were you able to resolve this issue? I am facing the same error. It would be great if you an share the resolution approach.

Thank you.

raj
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions