potiuk commented on a change in pull request #20329:
URL: https://github.com/apache/airflow/pull/20329#discussion_r773189450



##########
File path: airflow/providers/google/cloud/operators/bigquery.py
##########
@@ -948,7 +948,10 @@ def execute(self, context) -> None:
                 delegate_to=self.delegate_to,
                 impersonation_chain=self.impersonation_chain,
             )
-            schema_fields = json.loads(gcs_hook.download(gcs_bucket, 
gcs_object).decode("utf-8"))
+            schema_fields_bytes_or_string = gcs_hook.download(gcs_bucket, 
gcs_object)
+            if hasattr(schema_fields_bytes_or_string, 'decode'):
+                schema_fields_bytes_or_string = cast(bytes, 
schema_fields_bytes_or_string).decode("utf-8")
+            schema_fields = json.loads(schema_fields_bytes_or_string)
         else:

Review comment:
       Good point. I changed it in the way that I created a separate method in 
the hook that only returns bytes (and does not pass filename) and cast it to 
`bytes` - with appropriate comment.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to