gemini-code-assist[bot] commented on code in PR #36393:
URL: https://github.com/apache/beam/pull/36393#discussion_r2407609532


##########
sdks/python/apache_beam/io/gcp/bigquery.py:
##########
@@ -2764,6 +2764,9 @@ def expand(self, input):
 
   class ConvertToBeamRows(PTransform):
     def __init__(self, schema, dynamic_destinations):
+      if not isinstance(schema,
+                        (bigquery.TableSchema, bigquery.TableFieldSchema)):
+        schema = bigquery_tools.get_bq_tableschema(schema)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This is a good optimization to parse the schema once at transform 
construction. This change makes the schema parsing logic inside 
`bigquery_tools.beam_row_from_dict` redundant. To improve maintainability and 
prevent confusion, consider removing the redundant check from 
`beam_row_from_dict` as part of this PR or in a follow-up change.



-- 
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