Skip to content

Derive partition_date for composite keys with one temporal dimension#68442

Merged
Lee-W merged 2 commits into
apache:mainfrom
astronomer:fix-composite-partition-date-gaps
Jun 17, 2026
Merged

Derive partition_date for composite keys with one temporal dimension#68442
Lee-W merged 2 commits into
apache:mainfrom
astronomer:fix-composite-partition-date-gaps

Conversation

@Lee-W

@Lee-W Lee-W commented Jun 12, 2026

Copy link
Copy Markdown
Member

Why

ProductMapper lacked a to_partition_date implementation, so backfill Dag runs built from composite partition keys (e.g. date|region) never had partition_date set — even when exactly one dimension was temporal. A separate gap in _handle_clear_run dropped partition_key when creating the BackfillDagRun on the clear/reprocess path, while all other creation sites in that file already forwarded it.

What

  • ProductMapper.to_partition_date: splits the downstream key by delimiter, delegates to each child mapper, returns the single non-None anchor. Zero temporal children, two-or-more temporal children, and segment-count mismatch all return None.
  • _handle_clear_run in backfill.py: adds partition_key=info.partition_key so the clear path matches the other six BackfillDagRun creation sites.
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@Lee-W Lee-W requested review from XD-DENG, ashb and dstandish as code owners June 12, 2026 10:21
@Lee-W Lee-W self-assigned this Jun 15, 2026
@Lee-W Lee-W force-pushed the fix-composite-partition-date-gaps branch 3 times, most recently from 311e36f to 8b606b1 Compare June 15, 2026 12:57
@eladkal eladkal added this to the Airflow 3.3.0 milestone Jun 15, 2026
Comment thread airflow-core/src/airflow/models/backfill.py
Comment thread airflow-core/tests/unit/models/test_backfill.py Outdated
@Lee-W Lee-W force-pushed the fix-composite-partition-date-gaps branch from 8b606b1 to 1f37325 Compare June 17, 2026 05:42
Lee-W added 2 commits June 17, 2026 13:43
ProductMapper.to_partition_date now inspects each child mapper's segment:
exactly one non-None temporal anchor is returned; zero or multiple temporal
children (ambiguous) return None, matching the scheduler's leave-unset rule.
Also fixes _handle_clear_run to forward info.partition_key to BackfillDagRun,
consistent with all six other creation sites in that file.
@Lee-W Lee-W force-pushed the fix-composite-partition-date-gaps branch from 1f37325 to e414a81 Compare June 17, 2026 05:43
@Lee-W Lee-W merged commit 2963064 into apache:main Jun 17, 2026
77 checks passed
@Lee-W Lee-W deleted the fix-composite-partition-date-gaps branch June 17, 2026 06:52
@github-project-automation github-project-automation Bot moved this from In Review to Done in AIP-76 Asset Partitioning Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants