mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Fix bug where empty array always returned if there's any empty array as input
This commit is contained in:
parent
d29f0d4c96
commit
3153c0cf96
@ -160,13 +160,13 @@ DataTypePtr FunctionArrayIntersect<Mode>::getReturnTypeImpl(const DataTypes & ar
|
|||||||
const auto & nested_type = array_type->getNestedType();
|
const auto & nested_type = array_type->getNestedType();
|
||||||
|
|
||||||
if (typeid_cast<const DataTypeNothing *>(nested_type.get()))
|
if (typeid_cast<const DataTypeNothing *>(nested_type.get()))
|
||||||
|
{
|
||||||
|
if (std::is_same_v<Mode, ArrayModeIntersect>)
|
||||||
|
{
|
||||||
has_nothing = true;
|
has_nothing = true;
|
||||||
// {
|
break;
|
||||||
// if (std::is_same_v<Mode, ArrayModeIntersect>) {
|
}
|
||||||
// has_nothing = true;
|
}
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
else
|
else
|
||||||
nested_types.push_back(nested_type);
|
nested_types.push_back(nested_type);
|
||||||
}
|
}
|
||||||
@ -176,13 +176,11 @@ DataTypePtr FunctionArrayIntersect<Mode>::getReturnTypeImpl(const DataTypes & ar
|
|||||||
if (!nested_types.empty())
|
if (!nested_types.empty())
|
||||||
result_type = getMostSubtype(nested_types, true);
|
result_type = getMostSubtype(nested_types, true);
|
||||||
|
|
||||||
if (has_nothing)
|
// If found any DataTypeNothing in IntersectMode or all DattaTypeNothing in UnionMode
|
||||||
|
if (has_nothing || nested_types.empty())
|
||||||
result_type = std::make_shared<DataTypeNothing>();
|
result_type = std::make_shared<DataTypeNothing>();
|
||||||
// // If found any DataTypeNothing in IntersectMode or all DattaTypeNothing in UnionMode
|
else
|
||||||
// if (has_nothing || nested_types.empty())
|
result_type = getMostSubtype(nested_types, true);
|
||||||
// result_type = std::make_shared<DataTypeNothing>();
|
|
||||||
// else
|
|
||||||
// result_type = getMostSubtype(nested_types, true);
|
|
||||||
|
|
||||||
return std::make_shared<DataTypeArray>(result_type);
|
return std::make_shared<DataTypeArray>(result_type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user