-
Notifications
You must be signed in to change notification settings - Fork 169
Description
What happens?
Numeric values from duckdb-wasm can be returned in several formats, including Arrow's DecimalBigNum. When a value with a decimal point is returned via DecimalBigNum, it loses its decimal point.
To Reproduce
With this snippet, where connection is a DuckDB wasm connection:
const sql = `SELECT
1.234 as "n1",
1234.0*1.0/1000 as "n2"
`;
const results = await connection.query(sql);
console.log(results.toArray());the values returned become:
[ {"n1": 1234, "n2": 1.234} ]n1, as a constant, has lost its decimal point. It is returned as a DecimalBigNum. n2 has the correct decimal placement, and it is returned as a Javascript number. If you do any computation with n1, such as 1.234/1, it gets returned as a number and is correct.
This may be an Arrow issue with a mismatch between the IPC serialization of of DecimalBigNum between Rust and Javascript, but I don't have an easy way to test that, yet.
Browser/Environment:
node v18.16.0
Device:
MacBook Pro
DuckDB-Wasm Version:
1.28.1-dev179.0
DuckDB-Wasm Deployment:
Malloy VS Code Extension
Full Name:
Will Scullin