Skip to content

Commit ffbe1a0

Browse files
committed
feat: extend bigInt casting to support UBIGINT, HUGEINT, and UHUGEINT types
- Add support for casting UBIGINT, HUGEINT, and UHUGEINT to DOUBLE - Prevents BigInt issues in JavaScript when dealing with large integer types - Maintains backward compatibility with existing BIGINT handling
1 parent dc8ba03 commit ffbe1a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/duckdb/src/table/duckdb-table-utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ export function castDuckDBTypesForKepler(
111111
const quotedColumnName = quoteColumnName(name);
112112
if (type === 'GEOMETRY' && options.geometryToWKB) {
113113
return `ST_AsWKB(${quotedColumnName}) as ${quotedColumnName}`;
114-
} else if (type === 'BIGINT' && options.bigIntToDouble) {
114+
} else if (
115+
options.bigIntToDouble &&
116+
(type === 'BIGINT' || type === 'UBIGINT' || type === 'HUGEINT' || type === 'UHUGEINT')
117+
) {
118+
// Cast 64-bit and larger integer types to DOUBLE to avoid BigInt in JS
115119
return `CAST(${quotedColumnName} AS DOUBLE) as ${quotedColumnName}`;
116120
}
117121
return quotedColumnName;

0 commit comments

Comments
 (0)