Fix PVS check

This commit is contained in:
Pavel Kruglov 2021-06-10 20:47:34 +03:00
parent 29440011ae
commit f16f660636
2 changed files with 8 additions and 6 deletions

View File

@ -90,11 +90,14 @@ MaskInfo getMaskFromColumn(
return getMaskFromColumn(col->getNestedColumnPtr(), res, inverted, mask_used_in_expanding, default_value_in_expanding, inverted_mask_used_in_expanding, null_value, &null_map, nulls);
}
size_t size = column->size();
bool is_full_column = true;
if (mask_used_in_expanding && mask_used_in_expanding->size() != column->size())
{
is_full_column = false;
size_t size = is_full_column ? column->size() : mask_used_in_expanding->size();
size = mask_used_in_expanding->size();
}
res.resize(size);
bool only_null = column->onlyNull();

View File

@ -535,7 +535,6 @@ ColumnPtr FunctionAnyArityLogical<Impl, Name>::executeShortCircuit(ColumnsWithTy
UInt8 null_value = Name::name == NameAnd::name ? 1 : 0;
bool inverted = Name::name != NameAnd::name;
UInt8 default_value_in_expanding = Name::name == NameAnd::name ? 0 : 1;
bool result_is_nullable = result_type->isNullable();
IColumn::Filter mask;
IColumn::Filter * mask_used_in_expanding = nullptr;
@ -543,7 +542,7 @@ ColumnPtr FunctionAnyArityLogical<Impl, Name>::executeShortCircuit(ColumnsWithTy
/// If result is nullable, we need to create null bytemap of the resulting column.
/// We will fill it while extracting mask from arguments.
std::unique_ptr<IColumn::Filter> nulls;
if (result_is_nullable)
if (result_type->isNullable())
nulls = std::make_unique<IColumn::Filter>(arguments[0].column->size(), 0);
MaskInfo mask_info = {.has_once = true, .has_zeros = false};
@ -565,13 +564,13 @@ ColumnPtr FunctionAnyArityLogical<Impl, Name>::executeShortCircuit(ColumnsWithTy
else if (inverted)
inverseMask(mask);
if (result_is_nullable)
if (nulls)
applyTernaryLogic<Name>(mask, *nulls);
MutableColumnPtr res = ColumnUInt8::create();
typeid_cast<ColumnUInt8 *>(res.get())->getData() = std::move(mask);
if (!result_is_nullable)
if (!nulls)
return res;
MutableColumnPtr bytemap = ColumnUInt8::create();