potiuk commented on code in PR #38408:
URL: https://github.com/apache/airflow/pull/38408#discussion_r1552213981


##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -322,8 +322,26 @@ def execute(self, context: Context):
                     ),
                     method_name="execute_complete",
                 )
+            self._handle_job_error(job)
+            # job.result() returns a RowIterator. Mypy expects an instance of 
SupportsNext[Any] for
+            # the next() call which the RowIterator does not resemble to. 
Hence, ignore the arg-type error.
+            records = next(job.result())  # type: ignore[arg-type]

Review Comment:
   Well. For me it looks like we should fix it in both places -  both seem 
wrong,. Seems like in both cases we get over the error accidentally - because 
single record is a tuple, it's also iterable, so the all() check in 
"validate_records" and the checks done in "check_value" are iterating over 
fields in the record not over the records themselves - and it checks for 
something different than intended.
   
   It seems that (at least that would be logical thing to do here), the right 
apprach should be to do:
   
   ```python
   records = [ next(job.result() ]
   ```
   
   Which would turn the single record into an iterable array (and similar for 
`check_value`) - but that should of course be verified in some real case, if 
what we get is what we wanted to get.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to