Repository navigation
Fix exception when finding common supertype for tuples of different arities - #100699
Merged
Merged
Conversation
…rities When `use_variant_as_common_type` is enabled, `getLeastSuperTypeForTuple` would treat an empty tuple the same as "not yet initialized", because it checked `element_types.empty()` to detect the first tuple. An empty tuple legitimately has zero elements, so the initialization was skipped and the next (non-empty) tuple silently overwrote the state, losing the empty-tuple branch entirely. Introduce an explicit `initialized` flag so that an empty tuple is correctly recorded as the first tuple seen. In `FunctionIf::executeTuple`, the result type may now be `Variant` (wrapping tuples of different arities) rather than a plain `Tuple`. When the result is a `Variant`, the per-element loop must not run because the branches have different numbers of elements. Add a guard that returns `nullptr` (falling back to the generic `Variant` path) when the element counts of either input tuple or column disagree with the result tuple size. Closes #100691 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [d3364a8] Summary: ❌
AI ReviewSummaryThis PR fixes handling of tuple least-supertype inference when empty tuples are involved under Missing context
ClickHouse Rules
Final Verdict
|
Avogar
approved these changes
Mar 25, 2026
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 96.43% (27/28, 0 noise lines excluded) |
antonio2368
pushed a commit
that referenced
this pull request
Mar 25, 2026
The two `SELECT 'Ok' FROM system.text_log` assertions were flaky because text log writes are asynchronous and `SYSTEM FLUSH LOGS` does not guarantee all async text-log entries are fully materialized. CI logs from a failing run (PR #100699, amd_tsan) show ~430K messages dropped from `AsyncLogMessageQueue` due to queue overflow during the test's execution window, confirming the messages were permanently lost. The remaining `query_log` assertions are deterministic (synchronous flush) and fully cover the feature under test: correct `script_query_number` and `script_line_number` propagation. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100699&sha=d3364a856816a3c582441841e5a85806271c9a6f&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%201%2F2%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 task
Member
Author
|
|
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
The two `SELECT 'Ok' FROM system.text_log` assertions were flaky because text log writes are asynchronous and `SYSTEM FLUSH LOGS` does not guarantee all async text-log entries are fully materialized. CI logs from a failing run (PR ClickHouse#100699, amd_tsan) show ~430K messages dropped from `AsyncLogMessageQueue` due to queue overflow during the test's execution window, confirming the messages were permanently lost. The remaining `query_log` assertions are deterministic (synchronous flush) and fully cover the feature under test: correct `script_query_number` and `script_line_number` propagation. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100699&sha=d3364a856816a3c582441841e5a85806271c9a6f&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%201%2F2%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
When
use_variant_as_common_typeis enabled,getLeastSuperTypeForTupletreats an empty tuple the same as "not yet initialized" because it checkselement_types.empty()to detect the first tuple. An empty tuple legitimately has zero elements, so initialization is skipped and the next (non-empty) tuple silently overwrites the state.This introduces an explicit
initializedflag so that an empty tuple is correctly recorded.In
FunctionIf::executeTuple, the result type may now beVariant(wrapping tuples of different arities). The per-element loop must not run in that case because the branches have different numbers of elements. A guard is added that returnsnullptr(falling back to the genericVariantpath) when element counts disagree.Closes #100691
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix exception when computing common supertype for empty and non-empty tuples with
use_variant_as_common_typeenabled.Documentation entry for user-facing changes
Version info
26.4.1.280