Skip to content

Cover long-running jobs in the deferrable BigQuery check system test - #74356

Merged
henry3260 merged 1 commit into
apache:mainfrom
shahar1:system-test-bigquery-check-triggers-running
Oct 16, 2026
Merged

henry3260 merged 1 commit into
apache:mainfrom
shahar1:system-test-bigquery-check-triggers-running

Conversation

@shahar1

@shahar1 shahar1 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The deferrable BigQueryValueCheckOperator and BigQueryIntervalCheckOperator in the async BigQuery system test only ever ran trivial COUNT(*) queries, so their jobs were DONE before the trigger's first poll and the regression fixed in #74305 (#73981: triggers failed with Job running whenever the job was still RUNNING) could not be observed there.

This extends example_bigquery_queries_async.py with a view that is slow on purpose and runs both deferrable checks against it:

  • create_slow_view creates a JavaScript UDF with a fixed 5e8-iteration loop and a view over the existing two-row table that evaluates it per row, so a query over the view stays RUNNING for tens of seconds. CURRENT_TIMESTAMP() in the view keeps BigQuery from serving repeated checks from the query cache.
  • check_value_long_running (BigQueryValueCheckOperator, deferrable) and check_interval_long_running (BigQueryIntervalCheckOperator, deferrable) run against the view. They are wired outside the howto_operator_* doc snippets so the documentation examples stay unchanged.

Cost: on-demand billing charges for bytes scanned, not for UDF CPU time, and the view only reads the two-row table, so every check job is billed at BigQuery's 10 MB minimum.

Testing against a real BigQuery project (on-demand, no reservations):

  • With the trigger from before Keep polling in the BigQuery check triggers while a job is running #74305 (file checked out at eda8563d98^), check_value_long_running failed all three attempts with AirflowException: Job running (the check jobs took 15–45 s), reproducing BigQueryValueCheckTrigger and BigQueryIntervalCheckTrigger fail while the BigQuery job is still running #73981. In an earlier run with a shorter loop, check_interval_long_running also failed with the misreported Job completed message from the second bug in that issue.
  • With the current trigger, both long-running checks passed on the first attempt (check jobs took 8–48 s).
  • check_openlineage_events fails in my local pytest harness for both the modified Dag and the unmodified Dag (Couldn't find any OpenLineage transport configuration in task processes), so that task's result is unrelated to this change. The new tasks have no OpenLineage expectations.
  • Unit tests in providers/google/tests/unit/google/cloud/triggers/test_bigquery.py still cover the trigger logic; this PR only touches the system test.

related: #73981
related: #74305


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Claude Fable 5.1) following the guidelines

🤖 Generated with Claude Code

The deferrable value and interval checks in the async BigQuery system
test only ran trivial COUNT(*) queries, so their jobs were DONE before
the trigger's first poll. The regression fixed in apache#74305, where
BigQueryValueCheckTrigger and BigQueryIntervalCheckTrigger failed with
"Job running" while the job was still RUNNING (apache#73981), could therefore
never show up in the system test.

Add a view backed by a JavaScript UDF that keeps a query RUNNING for
tens of seconds and run both deferrable checks against it. The view
only reads the existing two-row table, so each check job is billed at
BigQuery's 10 MB minimum.
@boring-cyborg boring-cyborg Bot added area:providers provider:google Google (including GCP) related issues labels Oct 6, 2026
@shahar1

shahar1 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

CC: @molcay @VladaZakharova

@shahar1
shahar1 requested review from eladkal and potiuk October 6, 2026 15:42

@molcay molcay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Again, thanks for handling this matter!
Very much appreciated 🙇🏼

@aaron-y-chen aaron-y-chen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work :)

@henry3260
henry3260 merged commit b9aa889 into apache:main Oct 16, 2026
87 checks passed
@shahar1
shahar1 deleted the system-test-bigquery-check-triggers-running branch October 16, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants