File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ def validate(sql: str) -> ValidationResult:
105105 bytes_processed = 0
106106 try :
107107 bytes_processed = int (dry_run_series .get ('totalBytesProcessed' , 0 ))
108- except ValueError :
108+ except ( TypeError , ValueError ) :
109109 pass
110110 compiled_sql = dry_run_series .get ('dispatchedSql' , '' )
111111 referenced_tables = dry_run_series .get ('referencedTables' , None ) or []
Original file line number Diff line number Diff line change @@ -377,6 +377,24 @@ def test_validate_sql_with_unknown_exception(self):
377377
378378 self .assertEqual (expected , result )
379379
380+ def test_validate_sql_with_none_bytes_processed (self ):
381+ dry_run_result = pandas .Series (
382+ {'totalBytesProcessed' : None , 'dispatchedSql' : _QUERY }
383+ )
384+ self .mock_read_gbq_colab .return_value = dry_run_result
385+ expected = bigquery .ValidationSuccess (
386+ bytes_processed = 0 ,
387+ compiled_sql = _QUERY ,
388+ tables = [],
389+ schema = [],
390+ )
391+
392+ self .assertEqual (expected , bigquery .validate (_QUERY ))
393+
394+ self .mock_read_gbq_colab .assert_called_once_with (
395+ _QUERY , dry_run = True , pyformat_args = {}
396+ )
397+
380398
381399class RunTest (unittest .TestCase ):
382400
You can’t perform that action at this time.
0 commit comments