diff --git a/src/Columns/ColumnFunction.cpp b/src/Columns/ColumnFunction.cpp index 367821755a4..f12cfe47e4e 100644 --- a/src/Columns/ColumnFunction.cpp +++ b/src/Columns/ColumnFunction.cpp @@ -226,10 +226,9 @@ ColumnWithTypeAndName ColumnFunction::reduce() const if (is_short_circuit_argument) { /// Arguments of lazy executed function can also be lazy executed. - const ColumnFunction * arg; for (auto & col : columns) { - if ((arg = typeid_cast(col.column.get())) && arg->isShortCircuitArgument()) + if (const ColumnFunction * arg = checkAndGetShortCircuitArgument(col.column)) col = arg->reduce(); } } @@ -244,4 +243,12 @@ ColumnWithTypeAndName ColumnFunction::reduce() const return res; } +const ColumnFunction * checkAndGetShortCircuitArgument(const ColumnPtr & column) +{ + const ColumnFunction * column_function; + if ((column_function = typeid_cast(column.get())) && column_function->isShortCircuitArgument()) + return column_function; + return nullptr; +} + } diff --git a/src/Columns/ColumnFunction.h b/src/Columns/ColumnFunction.h index 5455a1afc05..da2e3406f55 100644 --- a/src/Columns/ColumnFunction.h +++ b/src/Columns/ColumnFunction.h @@ -173,6 +173,10 @@ private: bool is_function_compiled; void appendArgument(const ColumnWithTypeAndName & column); + + void addOffsetsForReplication(const IColumn::Offsets & offsets); }; +const ColumnFunction * checkAndGetShortCircuitArgument(const ColumnPtr & column); + } diff --git a/src/Columns/MaskOperations.cpp b/src/Columns/MaskOperations.cpp index c1fea729333..2b4dbed5dac 100644 --- a/src/Columns/MaskOperations.cpp +++ b/src/Columns/MaskOperations.cpp @@ -101,11 +101,6 @@ void expandOffsetsByMask(PaddedPODArray & offsets, const PaddedPODArray< throw Exception("Not enough bytes in mask", ErrorCodes::LOGICAL_ERROR); } -void expandColumnByMask(const ColumnPtr & column, const PaddedPODArray& mask, bool inverted) -{ - column->assumeMutable()->expand(mask, inverted); -} - MaskInfo getMaskFromColumn( const ColumnPtr & column, PaddedPODArray & res, @@ -197,8 +192,8 @@ void inverseMask(PaddedPODArray & mask) void maskedExecute(ColumnWithTypeAndName & column, const PaddedPODArray & mask, const MaskInfo & mask_info, bool inverted) { - const auto * column_function = checkAndGetColumn(*column.column); - if (!column_function || !column_function->isShortCircuitArgument()) + const auto * column_function = checkAndGetShortCircuitArgument(column.column); + if (!column_function) return; ColumnWithTypeAndName result; @@ -224,8 +219,8 @@ void maskedExecute(ColumnWithTypeAndName & column, const PaddedPODArray & void executeColumnIfNeeded(ColumnWithTypeAndName & column, bool empty) { - const auto * column_function = checkAndGetColumn(*column.column); - if (!column_function || !column_function->isShortCircuitArgument()) + const auto * column_function = checkAndGetShortCircuitArgument(column.column); + if (!column_function) return; if (!empty)