Repository navigation
Commit c4b3d52
committed
Fix crash in comparison constant folding with Variant NULL and LowCardinality
When use_variant_default_implementation_for_comparisons is disabled,
comparing a LowCardinality column with a Variant NULL constant crashes
in getConstantResultForNonConstArguments. The function detects a constant
NULL argument and calls result_type->createColumnConst(1, Null()), but
the result type is LowCardinality(UInt8) (non-nullable), causing
ColumnUnique::uniqueInsert to fail with "ColumnUnique can't contain null
values".
The Variant type can hold NULL without being Nullable, so getNullPresense
does not detect it as nullable, and the result type is not wrapped in
Nullable. When the Variant adaptor is bypassed (via the setting),
constant folding attempts to create a NULL constant of a non-nullable
type.
Fix: check isNullableOrLowCardinalityNullable(result_type) before
creating the NULL constant. If the result type cannot hold NULL, skip
constant folding and let the runtime execution path handle it.1 parent aef8cc3 commit c4b3d52
3 files changed
Lines changed: 38 additions & 0 deletions
File tree
- src/Functions
- tests/queries/0_stateless
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1524 | 1524 | | |
1525 | 1525 | | |
1526 | 1526 | | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1527 | 1533 | | |
| 1534 | + | |
1528 | 1535 | | |
1529 | 1536 | | |
1530 | 1537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments