mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
Update complie expressions.
This commit is contained in:
parent
7af517775b
commit
a77596b362
@ -795,7 +795,6 @@ void ActionsDAG::compileFunctions()
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<const Node *, Data> data;
|
std::unordered_map<const Node *, Data> data;
|
||||||
std::unordered_map<const Node *, llvm::Value *> constants;
|
|
||||||
|
|
||||||
for (const auto & node : nodes)
|
for (const auto & node : nodes)
|
||||||
data[&node].is_compilable = isCompilableConstant(node) || isCompilableFunction(node);
|
data[&node].is_compilable = isCompilableConstant(node) || isCompilableFunction(node);
|
||||||
@ -847,17 +846,19 @@ void ActionsDAG::compileFunctions()
|
|||||||
cur.num_inlineable_nodes += data[child].num_inlineable_nodes;
|
cur.num_inlineable_nodes += data[child].num_inlineable_nodes;
|
||||||
|
|
||||||
/// Check if we should inline current node.
|
/// Check if we should inline current node.
|
||||||
|
bool should_compile = true;
|
||||||
|
|
||||||
/// Inline parents instead of node is possible.
|
/// Inline parents instead of node is possible.
|
||||||
if (!cur.used_in_result && cur.all_parents_compilable)
|
if (!cur.used_in_result && cur.all_parents_compilable)
|
||||||
continue;
|
should_compile = false;
|
||||||
|
|
||||||
/// There is not reason to inline single node.
|
/// There is not reason to inline single node.
|
||||||
/// The result of compiling function in isolation is pretty much the same as its `execute` method.
|
/// The result of compiling function in isolation is pretty much the same as its `execute` method.
|
||||||
if (cur.num_inlineable_nodes <= 1)
|
if (cur.num_inlineable_nodes <= 1)
|
||||||
continue;
|
should_compile = false;;
|
||||||
|
|
||||||
/// Compile.
|
if (should_compile)
|
||||||
|
{
|
||||||
std::vector<Node *> new_children;
|
std::vector<Node *> new_children;
|
||||||
auto dag = getCompilableDAG(frame.node, new_children);
|
auto dag = getCompilableDAG(frame.node, new_children);
|
||||||
if (dag.size() != cur.num_inlineable_nodes)
|
if (dag.size() != cur.num_inlineable_nodes)
|
||||||
@ -873,8 +874,7 @@ void ActionsDAG::compileFunctions()
|
|||||||
ColumnsWithTypeAndName arguments;
|
ColumnsWithTypeAndName arguments;
|
||||||
arguments.reserve(new_children.size());
|
arguments.reserve(new_children.size());
|
||||||
for (const auto * child : new_children)
|
for (const auto * child : new_children)
|
||||||
arguments.emplace_back(
|
arguments.emplace_back(child->column, child->result_type, child->result_name);
|
||||||
ColumnWithTypeAndName{child->column, child->result_type, child->result_name});
|
|
||||||
|
|
||||||
frame.node->type = ActionsDAG::Type::FUNCTION;
|
frame.node->type = ActionsDAG::Type::FUNCTION;
|
||||||
frame.node->function_base = fn;
|
frame.node->function_base = fn;
|
||||||
@ -884,6 +884,7 @@ void ActionsDAG::compileFunctions()
|
|||||||
frame.node->column = nullptr; /// Just in case.
|
frame.node->column = nullptr; /// Just in case.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
visited.insert(frame.node);
|
visited.insert(frame.node);
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
Loading…
Reference in New Issue
Block a user