Updated tests

This commit is contained in:
Maksim Kita 2021-05-25 11:50:40 +03:00
parent b128221cf0
commit ba43fe784c
4 changed files with 14 additions and 18 deletions

View File

@ -374,6 +374,7 @@ function run_tests
01801_s3_cluster 01801_s3_cluster
# Depends on LLVM JIT # Depends on LLVM JIT
01072_nullable_jit
01852_jit_if 01852_jit_if
01865_jit_comparison_constant_result 01865_jit_comparison_constant_result
01871_merge_tree_compile_expressions 01871_merge_tree_compile_expressions

View File

@ -403,21 +403,15 @@ static CompileDAG getCompilableDAG(
if (!all_children_visited) if (!all_children_visited)
continue; continue;
/// Here we process only functions that are not compiled constants
CompileDAG::Node compile_node; CompileDAG::Node compile_node;
compile_node.function = node->function_base; compile_node.function = node->function_base;
compile_node.result_type = node->result_type; compile_node.result_type = node->result_type;
compile_node.type = CompileDAG::CompileType::FUNCTION;
// if (node->type == ActionsDAG::ActionType::FUNCTION) for (const auto * child : node->children)
// { compile_node.arguments.push_back(visited_node_to_compile_dag_position[child]);
compile_node.type = CompileDAG::CompileType::FUNCTION;
for (const auto * child : node->children)
compile_node.arguments.push_back(visited_node_to_compile_dag_position[child]);
// }
// else
// {
// compile_node.type = CompileDAG::CompileType::INPUT;
// children.emplace_back(node);
// }
visited_node_to_compile_dag_position[node] = dag.getNodesCount(); visited_node_to_compile_dag_position[node] = dag.getNodesCount();
@ -457,8 +451,7 @@ void ActionsDAG::compileFunctions(size_t min_count_to_compile_expression)
std::stack<Frame> stack; std::stack<Frame> stack;
std::unordered_set<const Node *> visited_nodes; std::unordered_set<const Node *> visited_nodes;
/** Algorithm is to iterate over each node in ActionsDAG, and update node compilable status. /** Algorithm is to iterate over each node in ActionsDAG, and update node compilable_children_size.
* Node is compilable if all its children are compilable and node is also compilable.
* After this procedure data for each node is initialized. * After this procedure data for each node is initialized.
*/ */

View File

@ -1,3 +1,5 @@
SET compile_expressions = 1;
DROP TABLE IF EXISTS foo; DROP TABLE IF EXISTS foo;
CREATE TABLE foo ( CREATE TABLE foo (
@ -12,7 +14,7 @@ CREATE TABLE foo (
INSERT INTO foo VALUES (1, 0.5, 0.2, 0.3, 0.8); INSERT INTO foo VALUES (1, 0.5, 0.2, 0.3, 0.8);
SELECT divide(sum(a) + sum(b), nullIf(sum(c) + sum(d), 0)) FROM foo SETTINGS compile_expressions = 1; SELECT divide(sum(a) + sum(b), nullIf(sum(c) + sum(d), 0)) FROM foo;
SELECT divide(sum(a) + sum(b), nullIf(sum(c) + sum(d), 0)) FROM foo SETTINGS compile_expressions = 1; SELECT divide(sum(a) + sum(b), nullIf(sum(c) + sum(d), 0)) FROM foo;
DROP TABLE foo; DROP TABLE foo;

View File

@ -6,9 +6,9 @@ SET compile_expressions=true;
-- CREATE TABLE will use global profile with default min_count_to_compile_expression=3 -- CREATE TABLE will use global profile with default min_count_to_compile_expression=3
-- so retry 3 times -- so retry 3 times
CREATE TABLE data_01875_1 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number,8) AS SELECT * FROM numbers(16384); CREATE TABLE data_01875_1 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number, 8) + 1 AS SELECT * FROM numbers(16384);
CREATE TABLE data_01875_2 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number,8) AS SELECT * FROM numbers(16384); CREATE TABLE data_01875_2 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number, 8) + 1 AS SELECT * FROM numbers(16384);
CREATE TABLE data_01875_3 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number,8) AS SELECT * FROM numbers(16384); CREATE TABLE data_01875_3 Engine=MergeTree ORDER BY number PARTITION BY bitShiftRight(number, 8) + 1 AS SELECT * FROM numbers(16384);
SELECT number FROM data_01875_3 WHERE number = 999; SELECT number FROM data_01875_3 WHERE number = 999;