uranusjr commented on code in PR #61464:
URL: https://github.com/apache/airflow/pull/61464#discussion_r2839488607


##########
airflow-core/src/airflow/models/backfill.py:
##########
@@ -221,14 +222,23 @@ def validate_sort_ordinal(self, key: str, val: int) -> 
int:
 def _get_latest_dag_run_row_query(*, dag_id: str, info: DagRunInfo, session: 
Session):
     from airflow.models import DagRun
 
+    if info.partition_key:
+        return (
+            select(DagRun)
+            .where(
+                DagRun.dag_id == dag_id,
+                DagRun.partition_key == info.partition_key,
+            )
+            .order_by(nulls_first(DagRun.start_date.desc(), session=session))

Review Comment:
   I just realised we probably can’t do this. (the logical_date variant was 
first introduced in #45062 fwict). This would put dag runs with null start_date 
first on Postgres, but on MySQL and SQLite, _null start_date rows will come 
last_. I’m not sure if we want to do this one way or the other, but we should 
do something to make the two return the same result.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to