Skip to content

Fix reversed direction examples in FanOutMapper docs#69313

Open
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:fix-fanout-direction-docs
Open

Fix reversed direction examples in FanOutMapper docs#69313
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:fix-fanout-direction-docs

Conversation

@Lee-W

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

Copy link
Copy Markdown
Member

Why

Window.Direction.FORWARD (the default) yields the period starting at the upstream key — the period it represents — while BACKWARD yields the trailing period ending at the key. The docstrings described it the other way around: they claimed FORWARD produced the trailing/"next" period, and the code examples set direction=Window.Direction.FORWARD to get the trailing window. An author following either docstring would pick the opposite direction from what they intended.

What

  • Rewrote the direction explanation in airflow-core/src/airflow/partition_mappers/temporal.py and task-sdk/src/airflow/sdk/definitions/partition_mappers/temporal.py to state that FORWARD starts at the upstream key and BACKWARD trails it.
  • Fixed the code examples to use Window.Direction.BACKWARD for the trailing period, and corrected the accompanying comments (e.g. "the 7 days the upstream Monday represents" vs. "the 7 days ending at the upstream Monday").

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

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

The FanOutMapper docstrings in core and the Task SDK both described
Window.Direction.FORWARD as producing a trailing/next period, but
FORWARD (the default) actually yields the period starting at the
upstream key; BACKWARD yields the trailing period ending at it. Both
copies are corrected and now match each other.
@Lee-W Lee-W marked this pull request as ready for review July 3, 2026 09:03
@Lee-W Lee-W self-assigned this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant