correctly use maskedExecute

This commit is contained in:
jsc0218 2024-02-14 17:20:13 +00:00
parent 4a48afb0ef
commit 0f6564627b
2 changed files with 12 additions and 11 deletions

View File

@ -58,7 +58,12 @@ void inverseMask(PaddedPODArray<UInt8> & mask, MaskInfo & mask_info);
/// If given column is lazy executed argument (ColumnFunction with isShortCircuitArgument() = true),
/// filter it by mask and then reduce. If inverted is true, we will work with inverted mask.
void maskedExecute(ColumnWithTypeAndName & column, const PaddedPODArray<UInt8> & mask, const MaskInfo & mask_info);
/// mask_info is used for for optimization in cases when we have all zeros or all ones in mask, so
/// in general case this info is not used and we can skip it.
void maskedExecute(
ColumnWithTypeAndName & column,
const PaddedPODArray<UInt8> & mask,
const MaskInfo & mask_info = {true, true});
/// If given column is lazy executed argument, reduce it. If empty is true,
/// create an empty column with the execution result type.

View File

@ -619,23 +619,19 @@ private:
const DataTypePtr & result_type,
const ColumnWithTypeAndName & last_argument) const
{
auto rows = default_mask.size();
auto mask_col = ColumnUInt8::create();
mask_col->getData() = std::move(default_mask);
ColumnPtr mask_col_res = std::move(mask_col);
IColumn::Filter mask(rows, 1);
auto mask_info = extractMask(mask, mask_col_res);
ColumnWithTypeAndName column_before_cast = last_argument;
maskedExecute(column_before_cast, mask, mask_info);
maskedExecute(column_before_cast, default_mask);
ColumnWithTypeAndName column_to_cast = {
column_before_cast.column->convertToFullColumnIfConst(),
column_before_cast.type,
column_before_cast.name};
auto casted = IColumn::mutate(castColumnAccurate(column_to_cast, result_type));
return {std::move(casted), mask_col_res};
auto mask_col = ColumnUInt8::create();
mask_col->getData() = std::move(default_mask);
return {std::move(casted), std::move(mask_col)};
}
void restoreShortCircuitColumn(