Skip to content

Fix Decimal to Interval conversion: catch error at type resolution time - #96111

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-decimal-to-interval-error
Feb 6, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-decimal-to-interval-error

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 5, 2026 •

Copy link
Copy Markdown
Member

The toInterval* functions (e.g. toIntervalMillisecond) only checked for incompatible Decimal input types at execution time inside ConvertImpl::execute. When a table was empty, no blocks were processed, so the function was never called and the error was silently missed.

Move the check to getReturnTypeImplRemovedNullable so it is caught during query analysis regardless of whether the table has data.

Also fix the error message in ConvertImpl::execute which included a mangled C++ type name from typeid(FromDataType).name() producing unreadable output like Decimal64/N2DB15DataTypeDecimalINS_7DecimalIlEEEE.

Closes #75451

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Note: Maybe we can implement conversion from Decimal to Interval later.

Version info

  • Merged into: 26.2.1.297

The `toInterval*` functions (e.g. `toIntervalMillisecond`) only checked
for incompatible Decimal input types at execution time inside
`ConvertImpl::execute`. When a table was empty, no blocks were processed,
so the function was never called and the error was silently missed.

Move the check to `getReturnTypeImplRemovedNullable` so it is caught
during query analysis regardless of whether the table has data.

Also fix the error message in `ConvertImpl::execute` which included a
mangled C++ type name from `typeid(FromDataType).name()` producing
unreadable output like `Decimal64/N2DB15DataTypeDecimalINS_7DecimalIlEEEE`.

Closes #75451

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e7311fa]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_binary, parallel) failure
03800_mv_from_iceberg FAIL cidb
Integration tests (arm_binary, distributed plan, 3/4) failure
test_refreshable_mv/test.py::test_backup_outer_table FAIL cidb, issue
Stress test (amd_debug) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb
Stress test (amd_tsan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-2da1) FAIL cidb, issue
Upgrade check (amd_release) failure
Cannot start clickhouse-server FAIL cidb
Check failed failure cidb

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Feb 5, 2026
@Algunenano Algunenano self-assigned this Feb 5, 2026
@alexey-milovidov
alexey-milovidov merged commit 10caee0 into master Feb 6, 2026
124 of 129 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-decimal-to-interval-error branch February 6, 2026 02:22
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange errors on Decimal type

3 participants