fix(bigquery): widen auto-detected partition window to avoid silent empty samples - #33221
fix(bigquery): widen auto-detected partition window to avoid silent empty samples#33221zerafachris wants to merge 2 commits into
Conversation
…mpty samples (open-metadata#33084) Time-unit and ingestion-time BigQuery partitions previously used a 1-unit window (1 day for DAY granularity, 1 hour for HOUR granularity). Any table whose most-recent partition is older than that window — GA4 exports (~2-day lag), weekly aggregates, slow-loading sources — was silently sampled as an empty result. The profiler still reported success, so tables that were never actually examined were indistinguishable from tables that were examined and found clean. Changes: • `partition.py` — increase the auto-detected default from 1 to 3 days for DAY-granularity TIME_UNIT / INGESTION_TIME partitions, and from 1 to 24 for HOUR-granularity partitions. Per-table profiler config overrides are unaffected: any explicitly set `partitionInterval` continues to take precedence via `get_partition_details`. • `sqlalchemy/sampler.py` — emit a `logger.warning` when a partitioned-table COUNT(*) returns 0 rows, naming the table, current window, and the docs link to widen it. This makes any remaining narrow-window case visible in run logs instead of silent. • `tests/unit/test_partition.py` — update the two existing INGESTION_TIME assertions for the new defaults; add `test_bigquery_time_unit_partition_default_intervals` covering both DAY (3-day window) and HOUR (24-hour window) for TIME_UNIT partitions. Prepared with AI assistance (Claude Code, Anthropic), reviewed for correctness before submission.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…H/YEAR MONTH- and YEAR-granularity TIME_UNIT and INGESTION_TIME partitions were given the same 3-day window as DAY partitions, which silently produced empty profiler samples for any monthly/yearly table whose most-recent partition is older than 3 days — exactly the failure this PR already fixed for hourly/daily tables. Introduces `_bigquery_window_for_granularity()` mapping each BigQuery partition granularity to an appropriately-sized window: - HOUR → 24 h - DAY → 3 days - MONTH → 35 days (covers a full month + buffer) - YEAR → 370 days (covers a full year + buffer) Two new test cases (MONTH and YEAR) added alongside the existing HOUR/DAY cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 1 resolved / 1 findingsWidens auto-detected partition windows for BigQuery TIME_UNIT and INGESTION_TIME partitions to prevent silent empty samples on tables with slow ingestion cadence. Scales ✅ 1 resolved✅ Edge Case: 3-day window still silently empty for MONTH/YEAR partitions
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Why
Fixes #33084
BigQuery TIME_UNIT and INGESTION_TIME partitions were auto-detected with a
partitionInterval=1(1 day for DAY granularity, 1 hour for HOUR granularity). Any table whose most-recent partition is older than that window is silently sampled as an empty result — the profiler reports success, so tables that were never actually examined are indistinguishable from tables that were examined and found clean.Common sources of this silent failure:
What changed
ingestion/src/metadata/sampler/partition.pyTIME_UNITauto-detection:partitionInterval=1→24(HOUR) or3(DAY/MONTH/YEAR)INGESTION_TIMEauto-detection: same changepartitionIntervalintableProfilerConfig.partitioningcontinues to take precedence via the existingget_partition_detailsearly-return pathingestion/src/metadata/sampler/sqlalchemy/sampler.py_get_asset_row_count(): emitlogger.warningwhen a partitioned-tableCOUNT(*)returns 0 rows, naming the table, current window, and the docs link to override it. This makes any remaining narrow-window case visible in run logs rather than silent.ingestion/tests/unit/test_partition.py1→24(HOUR) and3(DAY)test_bigquery_time_unit_partition_default_intervalscovering both DAY (3-day window) and HOUR (24-hour window) for TIME_UNIT partitionsTest evidence
The OpenMetadata ingestion package requires generated schema files not present in a shallow clone, which prevented running pytest in isolation. Logic was verified via a standalone script that mocks the pydantic models and calls the same branching logic directly — all 5 cases pass:
Prepared with AI assistance (Claude Code, Anthropic), reviewed for correctness before submission.