-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Summary
When using SQLRooms with DuckDB-WASM to display query results from Parquet files, DATE and DECIMAL columns are not rendered correctly:
- DATE columns display as
Date32<DAY>instead of a formatted date string - DECIMAL columns display as raw scaled integers (e.g.,
15130000000instead of1.513) unlesscastDecimalToDoubleis enabled, which then causes floating-point precision issues (e.g.,1.6700000000000002instead of1.67)
Environment
@sqlrooms/sql-editor: 0.26.0@sqlrooms/data-table: 0.26.0@sqlrooms/duckdb: 0.26.0@duckdb/duckdb-wasm: 1.30.0- Browser: Chrome
Steps to Reproduce
- Create a DuckDB connector with type casting options:
const duckDbConnector = createWasmDuckDbConnector({
query: {
castDecimalToDouble: true,
castTimestampToDate: true,
castBigIntToDouble: true,
},
});
- Load a Parquet file with DATE and DECIMAL columns
- Query the table and view results in
QueryResultPanel
Expected vs Actual Behavior
Column Type | Expected | Actual -- | -- | -- DATE | 2025-12-12 | Date32 DECIMAL(20,10) without config | 1.67 | 16700000000 (raw scaled integer) DECIMAL(20,10) with castDecimalToDouble | 1.67 | 1.6700000000000002 (float precision error)Root Cause
DATE Issue: In useArrowDataTable.js, the DATE handling assumes the value is already a JavaScript Date instance:
if (arrow.DataType.isDate(type)) {
if (value instanceof Date) { // <-- This check fails for Arrow Date32
return value.toISOString();
}
}
return String(value); // Falls through, showing "Date32<DAY>"
DuckDB-WASM's castTimestampToDate only affects TIMESTAMP, not DATE. The Arrow Date32 value is an integer (days since epoch), not a Date instance.
Related Issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels