This is an automated email from the ASF dual-hosted git repository.
Lee-W pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 73113791694 Fix reversed direction examples in FanOutMapper docs
(#69313)
73113791694 is described below
commit 7311379169462a12caad0f0ae64fbbae13b49b12
Author: Wei Lee <[email protected]>
AuthorDate: Tue Jul 7 12:12:41 2026 +0800
Fix reversed direction examples in FanOutMapper docs (#69313)
---
airflow-core/src/airflow/partition_mappers/temporal.py | 12 +++++++-----
.../airflow/sdk/definitions/partition_mappers/temporal.py | 15 +++++++++------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/airflow-core/src/airflow/partition_mappers/temporal.py
b/airflow-core/src/airflow/partition_mappers/temporal.py
index 1938a18f84d..c16801c97b1 100644
--- a/airflow-core/src/airflow/partition_mappers/temporal.py
+++ b/airflow-core/src/airflow/partition_mappers/temporal.py
@@ -469,9 +469,11 @@ class FanOutMapper(PartitionMapper):
is N→1 (downstream waits until all members arrive), fan-out is 1→N (one
upstream event creates one downstream Dag run per member).
- For forward fan-out (emit the trailing period ending at the upstream key,
- instead of the period it represents), pass
``direction=Window.Direction.FORWARD``
- to the window:
+ ``window``'s direction controls which period each upstream key fans out to.
+ The default, ``Window.Direction.FORWARD``, yields the period *starting at*
+ the upstream key (the period it represents); ``Window.Direction.BACKWARD``
+ yields the trailing period *ending at* the upstream key. Pass
+ ``direction=Window.Direction.BACKWARD`` to the window for the latter:
.. code-block:: python
@@ -482,8 +484,8 @@ class FanOutMapper(PartitionMapper):
FanOutMapper(upstream_mapper=StartOfWeekMapper(), window=WeekWindow())
# Weekly upstream → the 7 days ending at the upstream Monday (trailing
period)
- forward_window = WeekWindow(direction=Window.Direction.FORWARD)
- FanOutMapper(upstream_mapper=StartOfWeekMapper(),
window=forward_window)
+ backward_window = WeekWindow(direction=Window.Direction.BACKWARD)
+ FanOutMapper(upstream_mapper=StartOfWeekMapper(),
window=backward_window)
"""
# Keep ``FanOutMapper.default_downstream_mapper_by_window_name`` in sync
with
diff --git a/task-sdk/src/airflow/sdk/definitions/partition_mappers/temporal.py
b/task-sdk/src/airflow/sdk/definitions/partition_mappers/temporal.py
index 0cf0a705d5c..ccb1497f032 100644
--- a/task-sdk/src/airflow/sdk/definitions/partition_mappers/temporal.py
+++ b/task-sdk/src/airflow/sdk/definitions/partition_mappers/temporal.py
@@ -137,20 +137,23 @@ class FanOutMapper(PartitionMapper):
waits for all members), fan-out is 1→N (one upstream event creates many
downstream Dag runs).
- For forward fan-out (emit the *next* period's members instead of the
current
- one), pass ``direction=Window.Direction.FORWARD`` to the window:
+ ``window``'s direction controls which period each upstream key fans out to.
+ The default, ``Window.Direction.FORWARD``, yields the period *starting at*
+ the upstream key (the period it represents); ``Window.Direction.BACKWARD``
+ yields the trailing period *ending at* the upstream key. Pass
+ ``direction=Window.Direction.BACKWARD`` to the window for the latter:
.. code-block:: python
from airflow.sdk import WeekWindow, Window
from airflow.sdk.definitions.partition_mappers.temporal import
FanOutMapper, StartOfWeekMapper
- # Weekly upstream → 7 daily downstream Dag runs (current week)
+ # Weekly upstream → 7 daily downstream Dag runs (the 7 days the
upstream Monday represents)
FanOutMapper(upstream_mapper=StartOfWeekMapper(), window=WeekWindow())
- # Weekly upstream → 7 daily keys for the *following* week
- forward_window = WeekWindow(direction=Window.Direction.FORWARD)
- FanOutMapper(upstream_mapper=StartOfWeekMapper(),
window=forward_window)
+ # Weekly upstream → the 7 days ending at the upstream Monday (trailing
period)
+ backward_window = WeekWindow(direction=Window.Direction.BACKWARD)
+ FanOutMapper(upstream_mapper=StartOfWeekMapper(),
window=backward_window)
"""
# Keep ``FanOutMapper.default_downstream_mapper_by_window_name`` in sync
with