guan404ming commented on code in PR #63631:
URL: https://github.com/apache/airflow/pull/63631#discussion_r2943947910
##########
airflow-core/src/airflow/api_fastapi/core_api/services/ui/calendar.py:
##########
@@ -95,21 +93,25 @@ def _get_historical_dag_runs(
"""Get historical DAG runs from the database."""
dialect = get_dialect_name(session)
- time_expression =
self._get_time_truncation_expression(DagRun.logical_date, granularity, dialect)
+ effective_date = sa.func.coalesce(DagRun.partition_date,
DagRun.logical_date)
+ time_expression = self._get_time_truncation_expression(effective_date,
granularity, dialect)
select_stmt = (
sa.select(
time_expression.label("datetime"),
DagRun.state,
sa.func.max(DagRun.data_interval_start).label("data_interval_start"),
sa.func.max(DagRun.data_interval_end).label("data_interval_end"),
+ sa.func.max(DagRun.run_after).label("run_after"),
+ sa.func.max(DagRun.partition_date).label("partition_date"),
sa.func.count("*").label("count"),
)
.where(DagRun.dag_id == dag_id)
.group_by(time_expression, DagRun.state)
.order_by(time_expression.asc())
)
+ logical_date.attribute = effective_date
Review Comment:
I refactored this by adding a new field to the route to separate this which
I think it more clean way to solve this confusion.
--
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]