Skip to content

Fix reversed direction examples in FanOutMapper docs#69313

Merged
Lee-W merged 1 commit into
apache:mainfrom
astronomer:fix-fanout-direction-docs
Jul 7, 2026
Merged

Fix reversed direction examples in FanOutMapper docs#69313
Lee-W merged 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
@Lee-W
Lee-W requested a review from jason810496 July 6, 2026 08:36
@Lee-W Lee-W added the backport-to-v3-3-test Backport to v3-3-test label Jul 6, 2026
@Lee-W
Lee-W merged commit 7311379 into apache:main Jul 7, 2026
137 of 160 checks passed
@Lee-W
Lee-W deleted the fix-fanout-direction-docs branch July 7, 2026 04:12
@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

vatsrahul1001 pushed a commit that referenced this pull request Jul 7, 2026
)

(cherry picked from commit 7311379)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Lee-W added a commit that referenced this pull request Jul 7, 2026
)

(cherry picked from commit 7311379)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Lee-W added a commit that referenced this pull request Jul 8, 2026
vatsrahul1001 pushed a commit that referenced this pull request Jul 9, 2026
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