Skip to content

Commit 0e1a2c6

Browse files
chelsea-lintswastgcf-owl-bot[bot]
authored
chore: fix AttributeError when rowiterator has no attribute in g3 (#1709)
* chore: fix attributeerror for rowiterator has no attribute in g3 * Update bigframes/session/metrics.py Co-authored-by: Tim Sweña (Swast) <swast@google.com> * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix mypy --------- Co-authored-by: Tim Sweña (Swast) <swast@google.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7961681 commit 0e1a2c6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bigframes/session/metrics.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ def count_job_stats(
4040
):
4141
if query_job is None:
4242
assert row_iterator is not None
43-
if (row_iterator.total_bytes_processed is None) or (
44-
row_iterator.query is None
45-
):
43+
total_bytes_processed = getattr(row_iterator, "total_bytes_processed", None)
44+
query = getattr(row_iterator, "query", None)
45+
if total_bytes_processed is None or query is None:
4646
return
47-
query_char_count = len(row_iterator.query)
48-
bytes_processed = row_iterator.total_bytes_processed
47+
4948
self.execution_count += 1
50-
self.query_char_count += query_char_count
51-
self.bytes_processed += bytes_processed
52-
write_stats_to_disk(query_char_count, bytes_processed)
49+
self.query_char_count += len(query)
50+
self.bytes_processed += total_bytes_processed
51+
write_stats_to_disk(len(query), total_bytes_processed)
5352
return
5453

5554
stats = get_performance_stats(query_job)

0 commit comments

Comments
 (0)