Fixed fuzz test and incorrect behaviour of bitTestAll/Any functions

This commit is contained in:
Alexey Milovidov 2020-02-16 09:46:29 +03:00
parent 6f51f089ec
commit 724be6d08f

View File

@ -175,21 +175,21 @@ private:
} }
template <typename PosType, typename ValueType> template <typename PosType, typename ValueType>
bool addToMaskImpl(PaddedPODArray<ValueType> & mask, const IColumn * const pos_col_untyped) bool NO_SANITIZE_UNDEFINED addToMaskImpl(PaddedPODArray<ValueType> & mask, const IColumn * const pos_col_untyped)
{ {
if (const auto pos_col = checkAndGetColumn<ColumnVector<PosType>>(pos_col_untyped)) if (const auto pos_col = checkAndGetColumn<ColumnVector<PosType>>(pos_col_untyped))
{ {
const auto & pos = pos_col->getData(); const auto & pos = pos_col->getData();
for (const auto i : ext::range(0, mask.size())) for (const auto i : ext::range(0, mask.size()))
mask[i] = mask[i] | (1 << pos[i]); mask[i] = mask[i] | (PosType(1) << pos[i]);
return true; return true;
} }
else if (const auto pos_col_const = checkAndGetColumnConst<ColumnVector<PosType>>(pos_col_untyped)) else if (const auto pos_col_const = checkAndGetColumnConst<ColumnVector<PosType>>(pos_col_untyped))
{ {
const auto & pos = pos_col_const->template getValue<PosType>(); const auto & pos = pos_col_const->template getValue<PosType>();
const auto new_mask = 1 << pos; const auto new_mask = PosType(1) << pos;
for (const auto i : ext::range(0, mask.size())) for (const auto i : ext::range(0, mask.size()))
mask[i] = mask[i] | new_mask; mask[i] = mask[i] | new_mask;