pierrejeambrun opened a new pull request, #70833:
URL: https://github.com/apache/airflow/pull/70833

   The Dag run duration-stats endpoint crashes with a `TypeError` on PostgreSQL 
14 and newer.
   
   PostgreSQL 14 changed `EXTRACT(epoch FROM ...)` to return `numeric` instead 
of `double precision`, so `DagRun.duration` is hydrated as `decimal.Decimal` on 
Postgres 14+. The percentile interpolation in `compute_duration_stats` 
multiplies that value by a `float`, which Python disallows for `Decimal` 
(`unsupported operand type(s) for *: 'decimal.Decimal' and 'float'`), so the 
endpoint 500s for any Dag that has completed runs.
   
   Coercing the durations to `float` up front keeps the computation 
backend-agnostic (Postgres `Decimal`, MySQL `int`, SQLite `float`). Adds a 
parametrized unit test that reproduces the crash with `Decimal` inputs and 
passes with the fix.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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