perf(ingest/bigquery): partition-ID sentinel constants + prebuilt system-tables deny pattern [2/9] - #19479
Conversation
… system-tables deny pattern PR 2/9 of splitting #12825. - Hoist BigQuery's virtual/sentinel partition IDs (__NULL__, __UNPARTITIONED__, __STREAMING_UNPARTITIONED__) into named constants in common.py plus a BQ_SPECIAL_PARTITION_IDS frozenset, and interpolate them into the legacy-stats dataset query in queries.py instead of repeating the magic strings inline. - Build the immutable system-tables AllowDenyPattern once at module scope rather than reconstructing it on every BigQueryFilter.is_allowed() call (invoked per table during ingestion). Behaviour-preserving; the sentinel constants are consumed by the partition discovery layer later in the stack. Co-authored-by: Cursor <cursoragent@cursor.com>
PR SummaryOverview Adds shared constants in Performance: Reviewed by Cursor Bugbot for commit 02953d2. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Connector Tests ResultsAll connector tests passed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |
…n-stats query tables_for_dataset_with_partition_stats hardcoded the __NULL__/__UNPARTITIONED__/ __STREAMING_UNPARTITIONED__ sentinels while the sibling legacy-stats query used the canonical BQ_*_PARTITION_ID constants. Interpolate the constants in both queries so the two paths cannot drift. Co-authored-by: Cursor <cursoragent@cursor.com>
…entinel-constants
Summary
PR 2 of 9 splitting #12825. Stacked on #19478.
Small, behaviour-preserving cleanup that the partition-discovery layer later in the stack depends on:
__NULL__,__UNPARTITIONED__,__STREAMING_UNPARTITIONED__) into named constants + aBQ_SPECIAL_PARTITION_IDSfrozenset incommon.py, and interpolate them into the legacy-stats dataset query inqueries.pyrather than repeating the magic strings inline.AllowDenyPatternonce at module scope instead of reconstructing it on everyBigQueryFilter.is_allowed()call (invoked per table during ingestion).Stack
Base ← #19478 (1/9). Next:
PartitionInfomulti-column model (3/9).Test plan
pytest tests/unit/bigquery/test_bigquery_source.py— 135 passedqueries.pykeeps the.format(project_id=…, dataset_name=…, table_filter=…)placeholders intact for the (unchanged) callersSummary by cubic
Hoists BigQuery's sentinel partition IDs into named constants and prebuilds the system-tables deny pattern once, avoiding per-call reconstruction during ingestion. Both the legacy-stats and partition-stats queries in
queries.pynow interpolate the constants instead of hardcoding the magic strings, so the two paths can't drift. Behavior is unchanged; the constants are consumed by the upcoming partition-discovery work.Written for commit 02953d2. Summary will update on new commits.