Skip to content

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

Open
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:fix-rollup-guard-symmetry
Open

Reject mismatched rollup mapper and window pairings at Dag parse time#69456
Lee-W wants to merge 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

is_rollup: ClassVar[bool] = False

# Class-level default so the attribute resolves even on subclasses whose

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a missed removal in a previous PR

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

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