fix(clickhouse): preserve Decimal precision when scale is null (#2192) - #2314
Merged
openai0229 merged 2 commits intoJul 28, 2026
Merged
Conversation
openai0229
force-pushed
the
260728-fix-clickhouse-decimal-precision
branch
from
July 28, 2026 12:52
98253cc to
b0cb0d7
Compare
…Mind#2192) Change the guard condition from (columnSize == null || decimalDigits == null) to (columnSize == null) only. This prevents an early return that drops precision when scale is null but precision is set. Also fix the size-only branch to output Decimal(P,0) instead of Decimal(P) since ClickHouse requires both P and S. Co-authored-by: monkeycode-ai <monkeycode-ai@chaitin.com>
openai0229
force-pushed
the
260728-fix-clickhouse-decimal-precision
branch
from
July 28, 2026 13:02
b0cb0d7 to
c03a49b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: fix(clickhouse): preserve Decimal precision when scale is null
Description:
Fixes #2192
The buildDataType method in ClickHouseColumnTypeEnum uses columnSize == null || decimalDigits == null as a guard condition for Decimal types. This causes an early return that drops precision when columnSize is set but decimalDigits is null.
Before
Decimal(10) (precision=10, scale=null) → Decimal (precision dropped, broken DDL)
Decimal(10,5) → Decimal(10,5)
After
Decimal(10) → Decimal(10,0) (preserves precision, uses 0 as default scale)
Decimal(10,5) → Decimal(10,5) (unchanged)
Changes
Changed guard from columnSize == null || decimalDigits == null to columnSize == null only
Fixed the size-only branch to output Decimal(P,0) (ClickHouse requires both P and S)
Removed unreachable dead code in the previous two-branch else if structure