mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge pull request #22026 from kitaisreal/cast-to-enum-nullable-fix
Cast to enum nullable fix
This commit is contained in:
commit
150a2df9df
@ -2798,12 +2798,16 @@ private:
|
||||
auto & out_data = static_cast<typename EnumType::ColumnType &>(*res).getData();
|
||||
out_data.resize(size);
|
||||
|
||||
auto default_enum_value = result_type.getValues().front().second;
|
||||
|
||||
if (nullable_col)
|
||||
{
|
||||
for (const auto i : ext::range(0, size))
|
||||
{
|
||||
if (!nullable_col->isNullAt(i))
|
||||
out_data[i] = result_type.getValue(col->getDataAt(i));
|
||||
else
|
||||
out_data[i] = default_enum_value;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
SELECT toUInt8(assumeNotNull(cast(cast(NULL, 'Nullable(String)'), 'Nullable(Enum8(\'Hello\' = 1))')));
|
Loading…
Reference in New Issue
Block a user