Fix FunctionVariantAdaptor exception when nested function returns Nothing type#97213
Merged
alexey-milovidov merged 3 commits intomasterfrom Feb 18, 2026
Merged
Fix FunctionVariantAdaptor exception when nested function returns Nothing type#97213alexey-milovidov merged 3 commits intomasterfrom
alexey-milovidov merged 3 commits intomasterfrom
Conversation
…hing type When `FunctionVariantAdaptor` executes a function on a Variant column that contains a single variant (e.g., `Array(Nothing)` from an empty array literal `[]`), the nested function can return a result of type `Nothing`. The code only checked for `Nullable(Nothing)` via `onlyNull` but missed plain `Nothing`, causing a failed cast to the expected `Variant(...)` result type and a `LOGICAL_ERROR` exception. Add `isNothing` checks alongside existing `onlyNull` checks in all three execution paths (single variant no NULLs, single variant with NULLs, multiple variants) to treat `Nothing` results as defaults/NULLs. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=42be5daa2cfd617b45ee36eeec6d72fd405fba41&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_debug%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Member
Author
|
Looks reasonable. |
bharatnc
approved these changes
Feb 17, 2026
…ot support Variant type inference in UNION ALL Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 18, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 18, 2026
Cherry pick #97213 to 26.1: Fix FunctionVariantAdaptor exception when nested function returns Nothing type
robot-clickhouse
added a commit
that referenced
this pull request
Feb 18, 2026
…sted function returns Nothing type
clickhouse-gh bot
added a commit
that referenced
this pull request
Feb 18, 2026
Backport #97213 to 26.1: Fix FunctionVariantAdaptor exception when nested function returns Nothing type
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.
Summary
LOGICAL_ERRORexception inFunctionVariantAdaptorwhen a nested function returnsNothingtype (e.g.,arrayElementonArray(Nothing)from an empty array literal[]in aUNION ALLwith Variant arrays)isNothingchecks alongside existingonlyNullchecks in all three execution paths to treatNothingresults as defaults/NULLsCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=42be5daa2cfd617b45ee36eeec6d72fd405fba41&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_debug%29
Test plan
03918_variant_adaptor_nothing_typeclickhouse-localusing both simplified and original fuzzer queriesChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
LOGICAL_ERRORexception inFunctionVariantAdaptorwhen a function operating on Variant columns returnsNothingtype, which can happen with empty arrays inUNION ALLqueries.🤖 Generated with Claude Code