Skip to content

feat: add support to DECIMAL duckdb column type - #3341

Merged
lixun910 merged 1 commit into
masterfrom
xli-support-decimal-duckdb-column-type
Feb 13, 2026
Merged

feat: add support to DECIMAL duckdb column type#3341
lixun910 merged 1 commit into
masterfrom
xli-support-decimal-duckdb-column-type

Conversation

@lixun910

@lixun910 lixun910 commented Feb 13, 2026

Copy link
Copy Markdown
Collaborator

ISSUE: DECIMAL duckdb columns have been parsed as string type in kepler

Copilot AI review requested due to automatic review settings February 13, 2026 00:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds DuckDB DECIMAL column handling for Kepler ingestion by coercing DECIMAL-typed columns to DOUBLE in the generated SELECT statement, along with a unit test covering common DECIMAL type strings.

Changes:

  • Update castDuckDBTypesForKepler to cast DECIMAL* columns to DOUBLE.
  • Add a Tape test ensuring DECIMAL columns are cast as expected.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/node/utils/duckdb-utils-test.js Adds coverage for DECIMAL type casting behavior in generated SQL.
src/duckdb/src/table/duckdb-table-utils.ts Extends type casting logic to include DECIMAL* alongside large integer types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

type === 'UBIGINT' ||
type === 'HUGEINT' ||
type === 'UHUGEINT' ||
type.startsWith('DECIMAL'))

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type.startsWith('DECIMAL') can throw at runtime if type is undefined/non-string (e.g., getDuckDBColumnTypes assigns columnTypes?.get(i) with optional chaining). Consider normalizing/guarding first (e.g., const t = typeof type === 'string' ? type : '') before calling startsWith.

Suggested change
type.startsWith('DECIMAL'))
(typeof type === 'string' && type.startsWith('DECIMAL')))

Copilot uses AI. Check for mistakes.
Comment on lines 141 to 150
} else if (
options.bigIntToDouble &&
(type === 'BIGINT' || type === 'UBIGINT' || type === 'HUGEINT' || type === 'UHUGEINT')
(type === 'BIGINT' ||
type === 'UBIGINT' ||
type === 'HUGEINT' ||
type === 'UHUGEINT' ||
type.startsWith('DECIMAL'))
) {
// Cast 64-bit and larger integer types to DOUBLE to avoid BigInt in JS
// Cast 64-bit and larger integer types and DECIMAL to DOUBLE to avoid BigInt in JS
return `CAST(${quotedColumnName} AS DOUBLE) as ${quotedColumnName}`;

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bigIntToDouble now also controls DECIMAL casting, which is a behavioral/API mismatch with the option name (and could surprise callers who disable BigInt casting but still want DECIMAL coerced for Kepler compatibility). Consider introducing a separate option (e.g., decimalToDouble) or renaming/generalizing the option while keeping backward compatibility.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. But I just want to make a simple change

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lixun910
lixun910 merged commit cc33b0c into master Feb 13, 2026
21 checks passed
@lixun910
lixun910 deleted the xli-support-decimal-duckdb-column-type branch February 13, 2026 03:20
hengshan pushed a commit to hengshan/palmocean that referenced this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants