Fix fuzz test

This commit is contained in:
Alexey Milovidov 2020-08-01 21:52:30 +03:00
parent e9b5687e68
commit 435164cfbb
3 changed files with 23 additions and 3 deletions

View File

@ -199,12 +199,20 @@ struct ValueGetterBuilderImpl<Type, Types...>
{
static TernaryValueGetter build(const IColumn * x)
{
if (const auto * nullable_column = typeid_cast<const ColumnNullable *>(x))
if (x->onlyNull())
{
return [](size_t){ return Ternary::Null; };
}
else if (const auto * nullable_column = typeid_cast<const ColumnNullable *>(x))
{
if (const auto * nested_column = typeid_cast<const ColumnVector<Type> *>(nullable_column->getNestedColumnPtr().get()))
{
return [&null_data = nullable_column->getNullMapData(), &column_data = nested_column->getData()](size_t i)
{ return Ternary::makeValue(column_data[i], null_data[i]); };
return [
&null_data = nullable_column->getNullMapData(),
&column_data = nested_column->getData()](size_t i)
{
return Ternary::makeValue(column_data[i], null_data[i]);
};
}
else
return ValueGetterBuilderImpl<Types...>::build(x);

View File

@ -0,0 +1,6 @@
\N
1
\N
1
\N
1

View File

@ -0,0 +1,6 @@
SELECT NULL AND 1;
SELECT NULL OR 1;
SELECT materialize(NULL) AND 1;
SELECT materialize(NULL) OR 1;
SELECT arrayJoin([NULL]) AND 1;
SELECT arrayJoin([NULL]) OR 1;