Try to improve short circuit functions processing

This commit is contained in:
avogar 2022-05-20 10:47:28 +00:00
parent 8dcee2813d
commit 5d19150906

View File

@ -160,8 +160,12 @@ static void setLazyExecutionInfo(
const ActionsDAGReverseInfo::NodeInfo & node_info = reverse_info.nodes_info[reverse_info.reverse_index.at(node)];
/// If node is used in result or it doesn't have parents, we can't enable lazy execution.
if (node_info.used_in_result || node_info.parents.empty())
if (node_info.used_in_result || node_info.parents.empty() || node->type != ActionsDAG::ActionType::FUNCTION
|| node->type != ActionsDAG::ActionType::ALIAS)
{
lazy_execution_info.can_be_lazy_executed = false;
return;
}
/// To fill lazy execution info for current node we need to create it for all it's parents.
for (const auto & parent : node_info.parents)
@ -172,7 +176,7 @@ static void setLazyExecutionInfo(
{
/// Use set, because one node can be more than one argument.
/// Example: expr1 AND expr2 AND expr1.
std::set<size_t> indexes;
std::unordered_set<size_t> indexes;
for (size_t i = 0; i != parent->children.size(); ++i)
{
if (node == parent->children[i])