adriangb commented on PR #27478:
URL: https://github.com/apache/datafusion/pull/27478#issuecomment-6931406307
I checked the SQL that this PR writes on real engines. I generated the SQL
with the unparser at `c4a98e3`, for ±inf and NaN as `Float64` and `Float32`,
and ran the exact strings. Each value was checked with `isinf`/`isnan`, or by
comparing it with ±1e308.
| Dialect → engine | SQL from this PR | Result |
|---|---|---|
| Default → DataFusion | `CAST('Infinity' AS DOUBLE)`, `CAST('Infinity' AS
FLOAT)` | `inf` / `-inf` / `NaN`, same `Float64` / `Float32` type ✅ |
| PostgreSQL → PostgreSQL 17.11 | `CAST('Infinity' AS DOUBLE PRECISION)`,
f32: `CAST('Infinity' AS FLOAT)` | Values correct ✅. PostgreSQL reads `FLOAT`
as `double precision`, so f32 widens. That type mapping is older than this PR. |
| DuckDB → DuckDB 2.0.0 | `CAST('Infinity' AS DOUBLE)`, `CAST('Infinity' AS
FLOAT)` | Values correct, `DOUBLE` / `FLOAT` types ✅ |
| SQLite → SQLite 3.54 | `9e999` / `-9e999`. NaN returns a not-implemented
error. | `Inf` / `-Inf`, type `real` ✅. For comparison, `CAST('Infinity' AS
REAL)` gives `0.0` in SQLite. |
| MySQL | not-implemented error for every value | No SQL is written, so
there is nothing to run. |
| BigQuery → BigQuery | `CAST('Infinity' AS FLOAT64)`, f32: `CAST('Infinity'
AS FLOAT)` | f64 correct ✅. f32 fails with `Type not found: FLOAT`. The cause
is the dialect's `Float32` type name, which is older than this PR. I filed it
as #27491. |
So every `Float64` value round-trips on every engine that can hold it. The
only gap is `Float32` on BigQuery, which #27491 tracks.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]