You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by we...@apache.org on 2026/05/03 07:09:34 UTC

(airflow) branch main updated: fix(backfill): populate partition_date on partitioned backfill runs (#65998)

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 9b18d230d34 fix(backfill): populate partition_date on partitioned backfill runs (#65998)
9b18d230d34 is described below

commit 9b18d230d341167c1bad73a28cbb94cdf2b1b2ae
Author: Wei Lee <we...@gmail.com>
AuthorDate: Sun May 3 15:09:26 2026 +0800

    fix(backfill): populate partition_date on partitioned backfill runs (#65998)
---
 airflow-core/src/airflow/models/backfill.py     |  1 +
 airflow-core/tests/unit/models/test_backfill.py | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/airflow-core/src/airflow/models/backfill.py b/airflow-core/src/airflow/models/backfill.py
index febd22df461..03acbb1f133 100644
--- a/airflow-core/src/airflow/models/backfill.py
+++ b/airflow-core/src/airflow/models/backfill.py
@@ -487,6 +487,7 @@ def _create_backfill_dag_run_partitioned(
         ),
         logical_date=info.logical_date,
         partition_key=info.partition_key,
+        partition_date=info.partition_date,
         data_interval=info.data_interval if info.logical_date else None,
         run_after=info.run_after,
         conf=dag_run_conf,
diff --git a/airflow-core/tests/unit/models/test_backfill.py b/airflow-core/tests/unit/models/test_backfill.py
index a8d7eb70d98..25267b4a5c7 100644
--- a/airflow-core/tests/unit/models/test_backfill.py
+++ b/airflow-core/tests/unit/models/test_backfill.py
@@ -285,6 +285,17 @@ def test_create_backfill_partitioned(reverse, existing, start_date, dag_maker, s
     assert partition_keys == expected_dates
     assert all(x.state == DagRunState.QUEUED for x in dag_runs)
     assert all(x.conf == expected_run_conf for x in dag_runs)
+    # Calendar view filters partitioned Dags by partition_date, so the backfill
+    # path must populate it alongside partition_key. Verify that backfill copies
+    # info.partition_date faithfully — i.e. the stored value matches what the
+    # timetable computed for each partition_key.
+    expected_partition_date_by_key = {
+        info.partition_key: info.partition_date
+        for info in dag.iter_dagrun_infos_between(pendulum.parse("2026-02-15"), pendulum.parse("2026-02-24"))
+    }
+    assert [x.partition_date for x in dag_runs] == [
+        expected_partition_date_by_key[x.partition_key] for x in dag_runs
+    ]
 
 
 @pytest.mark.parametrize(