NUMERIC read as DOUBLE doesn't match Postgres's float8 cast
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #610 di @ItsM0rty — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 70/100
Direzione di ricerca
The issue identifies DecimalConversionDouble in the binary numeric decoder; start by finding that implementation and the tests for decoding PostgreSQL numeric values as DOUBLE. Compare binary protocol results with the text protocol and PostgreSQL's numeric::float8 cast for the reported values. Done means the binary path returns the same nearest double as PostgreSQL for these cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
On main (8d201d4), numeric values that the extension reads as DOUBLE (unconstrained numeric, or a numeric too wide for DuckDB's DECIMAL) sometimes differ from Postgres's own numeric::float8 cast:
memory D ATTACH '' as pg (TYPE postgres);
memory D SELECT n AS duckdb, f AS postgres, n = f AS same
FROM postgres_query('pg', 'SELECT n, n::float8 AS f FROM (
SELECT 8629433::numeric / 1000
UNION ALL SELECT avg(x) FROM (VALUES (275.38), (232.58), (785.33)) v(x)
UNION ALL SELECT 1e32
) t(n)');
┌───────────────────────┬───────────────────┬─────────┐
│ duckdb │ postgres │ same │
│ double │ double │ boolean │
├───────────────────────┼───────────────────┼─────────┤
│ 8629.432999999999 │ 8629.433 │ false │
│ 431.09666666666664 │ 431.0966666666667 │ false │
│ 9.999999999999999e+31 │ 1e+32 │ false │
└───────────────────────┴───────────────────┴─────────┘
These aren't the nearest double to the exact value, which is what Postgres's cast (through strtod) gives.
With SET pg_use_text_protocol = true the same query returns the correct values, so the problem is in decoding the binary numeric format. The cause is DecimalConversionDouble, which builds the double with floating-point arithmetic that rounds at each step.
- Lingua principale
- C++
- Stelle
- 373
- Fork
- 112
- Merge medio
- 9h 48m
- PR unite (30g)
- 28
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di duckdb/duckdb-postgres
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
duckdb/duckdb-postgres#618 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
duckdb/duckdb-postgres#594 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
duckdb/duckdb-postgres#575 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
duckdb/duckdb-postgres#564 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
duckdb/duckdb-postgres#491 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di duckdb/duckdb-postgres
Issue simili
-
binding:web core docs p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
RunanywhereAI/runanywhere-sdks#1123 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
NVIDIA-RTX/NRI#277 ·
I maintainer di solito rispondono entro 1 giorno