Skip to content

Reject mismatched rollup mapper and window pairings at Dag parse time#69456

Merged
Lee-W merged 1 commit into
apache:mainfrom
astronomer:fix-rollup-guard-symmetry
Jul 7, 2026
Merged

Reject mismatched rollup mapper and window pairings at Dag parse time#69456
Lee-W merged 1 commit into
apache:mainfrom
astronomer:fix-rollup-guard-symmetry

Conversation

@Lee-W

@Lee-W Lee-W commented Jul 6, 2026

Copy link
Copy Markdown
Member

Why

RollupMapper's type-pairing guard only caught one direction — a str-decoding mapper against a non-str window — so a datetime mapper paired with a str window slipped through parse and only blew up (silently, no audit log) on a later scheduler tick.

What

Both RollupMappers (core and SDK) now compare the upstream mapper's and window's declared expected_decoded_type directly, so either direction of mismatch is rejected at Dag parse time. expected_decoded_type becomes an explicit ClassVar on the base mapper (temporal mappers declare datetime) instead of being inferred from whether decode_downstream is overridden — a mapper that overrides the decode/encode hooks but still decodes to str stays valid against a str window.


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.

Port the SDK's declared expected_decoded_type onto core partition mappers
and compare declarations in both directions when constructing a rollup, so
a temporal upstream paired with a segment window fails at parse instead of
crashing every scheduler tick. Mappers that override decode_downstream but
still decode to str remain valid segment-window upstreams.
@Lee-W Lee-W added the backport-to-v3-3-test Backport to v3-3-test label Jul 6, 2026
Comment thread airflow-core/src/airflow/partition_mappers/base.py

@jason810496 jason810496 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.

Thanks for the improvement, LGTM.

@Lee-W Lee-W merged commit 4acd1a9 into apache:main Jul 7, 2026
103 checks passed
@Lee-W Lee-W deleted the fix-rollup-guard-symmetry branch July 7, 2026 04:22
@github-actions github-actions Bot added this to the Airflow 3.3.1 milestone Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.1 based on: backport label targeting v3-3-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 7, 2026
…g parse time (apache#69456)

(cherry picked from commit 4acd1a9)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 7, 2026
…g parse time (apache#69456)

(cherry picked from commit 4acd1a9)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants