The GitHub Actions job "Tests (ARM)" on airflow.git/main has succeeded.
Run started by GitHub user potiuk (triggered by potiuk).

Head commit for run:
37667f11aa37eb27072a79b2de1d5dbec09c2218 / Hemkumar Chheda 
<[email protected]>
Improve DB performance of datetime range filters filters in API queries (#66696)

* fix(api): replace COALESCE with index-friendly OR conditions in datetime 
range filters

Adds NullableDatetimeRangeFilter, a RangeFilter subclass for start_date/end_date
columns that emits OR predicates instead of COALESCE(col, now()), allowing
PostgreSQL to use btree indexes on those columns.

Two bugs fixed versus the original implementation in PR #66696:
- Lower bounds now use or_(col >= x, col.is_(None)) without a now() guard,
  so future-scheduled tasks (NULL start_date) are never incorrectly excluded.
- The factory dispatches on (attribute_name or filter_name), so aliased callers
  like datetime_range_filter_factory("dag_run_end_date", DagRun, "end_date")
  also receive NullableDatetimeRangeFilter rather than a plain RangeFilter.

* fix(api): scope NullableDatetimeRangeFilter to filter_name, not attribute_name

datetime_range_filter_factory("dag_run_start_date", DagRun, "start_date")
passes attribute_name="start_date", so the guard

    if (attribute_name or filter_name) in ("start_date", "end_date"):

resolved to "start_date" and incorrectly returned NullableDatetimeRangeFilter
for the dag_run_start/end_date filters in the DAGs route. Those columns are
reached via an outer join; NULL means "no run", not "currently running", so
the OR (col IS NULL) branch inflated total_entries counts.

The original COALESCE guard checked filter_name only, so "dag_run_start_date"
was excluded. Revert to filter_name to preserve those semantics — only
callers with filter_name="start_date" or "end_date" (task instances, dag_run,
job routes) get NullableDatetimeRangeFilter.

Fixes TestGetDags::test_get_dags failures for query_params 13/14/17/21/23.


* fix(tests): correct test_aliased_*_returns_nullable_filter assertions

The dag_run_start_date and dag_run_end_date filters in the DAGs route use
an outer join, so NULL means "the DAG has no runs" — not "currently running".
They must return a plain RangeFilter, not NullableDatetimeRangeFilter.

Replace the two tests that incorrectly expected NullableDatetimeRangeFilter
for aliased callers with tests that assert plain RangeFilter is returned.

Report URL: https://github.com/apache/airflow/actions/runs/26028900186

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to