Minor changes

This commit is contained in:
Pavel Kruglov 2021-06-07 14:23:34 +03:00
parent 3ec2ab6156
commit ab65b7f25d
3 changed files with 17 additions and 11 deletions

View File

@ -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<const ColumnFunction *>(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<const ColumnFunction *>(column.get())) && column_function->isShortCircuitArgument())
return column_function;
return nullptr;
}
}

View File

@ -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);
}

View File

@ -101,11 +101,6 @@ void expandOffsetsByMask(PaddedPODArray<UInt64> & offsets, const PaddedPODArray<
throw Exception("Not enough bytes in mask", ErrorCodes::LOGICAL_ERROR);
}
void expandColumnByMask(const ColumnPtr & column, const PaddedPODArray<UInt8>& mask, bool inverted)
{
column->assumeMutable()->expand(mask, inverted);
}
MaskInfo getMaskFromColumn(
const ColumnPtr & column,
PaddedPODArray<UInt8> & res,
@ -197,8 +192,8 @@ void inverseMask(PaddedPODArray<UInt8> & mask)
void maskedExecute(ColumnWithTypeAndName & column, const PaddedPODArray<UInt8> & mask, const MaskInfo & mask_info, bool inverted)
{
const auto * column_function = checkAndGetColumn<ColumnFunction>(*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<UInt8> &
void executeColumnIfNeeded(ColumnWithTypeAndName & column, bool empty)
{
const auto * column_function = checkAndGetColumn<ColumnFunction>(*column.column);
if (!column_function || !column_function->isShortCircuitArgument())
const auto * column_function = checkAndGetShortCircuitArgument(column.column);
if (!column_function)
return;
if (!empty)