Fix tests

This commit is contained in:
Pavel Kruglov 2021-06-07 17:09:05 +03:00
parent 6da03935af
commit 76b3ae4301
2 changed files with 9 additions and 7 deletions

View File

@ -136,7 +136,7 @@ MaskInfo getMaskFromColumn(
bool use_value_from_expanding_mask = mask_used_in_expanding && (!(*mask_used_in_expanding)[i] ^ inverted_mask_used_in_expanding);
if (use_value_from_expanding_mask)
value = inverted ? !default_value_in_expanding : default_value_in_expanding;
else if (only_null || (null_bytemap && (*null_bytemap)[i]))
else if (only_null || (null_bytemap && (*null_bytemap)[column_index]))
{
value = inverted ? !null_value : null_value;
if (nulls)

View File

@ -129,12 +129,8 @@ void ExpressionActions::rewriteArgumentsForShortCircuitFunctions(
size_t i = short_circuit_settings.enable_lazy_execution_for_first_argument ? 0 : 1;
for (; i < node.children.size(); ++i)
{
/// Prevent multiple execution in cases like (expr AND expr AND expr)
if (short_circuit_settings.enable_lazy_execution_for_first_argument || node.children[i] != node.children[0])
{
queue.push_back(node.children[i]);
argument_ancestor[node.children[i]] = i;
}
queue.push_back(node.children[i]);
argument_ancestor[node.children[i]] = i;
}
need_outside[&node] = false;
@ -143,6 +139,12 @@ void ExpressionActions::rewriteArgumentsForShortCircuitFunctions(
const ActionsDAG::Node * cur = queue.front();
queue.pop_front();
/// If lazy execution is disabled for the first argument, we should check case
/// when the other arguments use it.
/// Examples: and(expr, expr), and(expr, expr1(..., expr, ...))
if (!short_circuit_settings.enable_lazy_execution_for_first_argument && cur == node.children[0])
continue;
bool is_need_outside = false;
/// If action is used in result, we can't enable lazy execution.
if (data[reverse_index.at(cur)].used_in_result)