Fix exception in intDiv/intDivOrZero on arrays of nullable tuples#100895
Merged
Algunenano merged 1 commit intoClickHouse:masterfrom Mar 28, 2026
Merged
Conversation
`executeArrayWithNumericImpl` passed the input array's element type as `result_type` to the inner `executeImpl`, instead of the result array's element type. When all elements are NULL, `IFunction::execute`'s default Nullable handling short-circuits and creates a default column using the passed `result_type` — producing Float64 columns while serialization expected Int64. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [93ad667] Summary: ❌
AI ReviewSummaryThis PR fixes a real type mismatch in ClickHouse Rules
Final Verdict
|
Algunenano
added a commit
to Algunenano/ClickHouse
that referenced
this pull request
Mar 27, 2026
Replace the shallow `getDataType() != getColumnType()` check (which only compared top-level TypeIndex) with a recursive `columnMatchesType` that validates nested types inside Array, Nullable, Tuple, and Map. The shallow check missed mismatches like `Array(Nullable(Tuple(Int64, Int64)))` vs `Array(Nullable(Tuple(Float64, Float64)))` because both have top-level TypeIndex::Array. The deeper check would have detected the bug fixed in ClickHouse#100895 and provided a clear error message at the function boundary instead of a cryptic `Bad cast from type ColumnVector<double> to ColumnVector<long>` deep in serialization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 task
antaljanosbenjamin
approved these changes
Mar 27, 2026
Contributor
LLVM Coverage Report
Changed lines: 100.00% (5/5) · Uncovered code |
Merged
via the queue into
ClickHouse:master
with commit Mar 28, 2026
25ba302
151 of 153 checks passed
robot-clickhouse
added a commit
that referenced
this pull request
Mar 28, 2026
…ays of nullable tuples
robot-clickhouse
added a commit
that referenced
this pull request
Mar 28, 2026
…ays of nullable tuples
robot-clickhouse
added a commit
that referenced
this pull request
Mar 28, 2026
…ays of nullable tuples
robot-clickhouse
added a commit
that referenced
this pull request
Mar 28, 2026
…ays of nullable tuples
clickhouse-gh Bot
added a commit
that referenced
this pull request
Mar 28, 2026
Backport #100895 to 26.1: Fix exception in intDiv/intDivOrZero on arrays of nullable tuples
clickhouse-gh Bot
added a commit
that referenced
this pull request
Mar 28, 2026
Backport #100895 to 26.2: Fix exception in intDiv/intDivOrZero on arrays of nullable tuples
fm4v
added a commit
that referenced
this pull request
Mar 30, 2026
Backport #100895 to 26.3: Fix exception in intDiv/intDivOrZero on arrays of nullable tuples
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.
executeArrayWithNumericImplinFunctionBinaryArithmeticpassed the input array's element type asresult_typeto the innerexecuteImpl, instead of the result array's element type.This was harmless when actual values existed (the tuple function ignores
result_typeand computes correct columns viaelem_func->getResultType). But when all elements are NULL,IFunction::execute's default Nullable handling short-circuits and creates a default column using the passedresult_type:With the wrong
result_type(e.g.Nullable(Tuple(Float64, Float64))instead ofNullable(Tuple(Int64, Int64))), this produced Float64 columns while serialization expected Int64.Closes #100873
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix exception in
intDiv/intDivOrZeroon arrays of nullable tuples, e.g.SELECT intDiv([divide((1, 2), ... AND NULL)], 2).Documentation entry for user-facing changes