Fixed code review issues

This commit is contained in:
Maksim Kita 2021-05-08 12:19:20 +03:00
parent dd44d93f49
commit 6dc0dcdfa4
3 changed files with 11 additions and 20 deletions

View File

@ -185,7 +185,6 @@ function clone_submodules
contrib/dragonbox
contrib/fast_float
contrib/NuRaft
contrib/llvm
)
git submodule sync
@ -202,6 +201,7 @@ function run_cmake
"-DENABLE_LIBRARIES=0"
"-DENABLE_TESTS=0"
"-DENABLE_UTILS=0"
"-DENABLE_EMBEDDED_COMPILER=0"
"-DENABLE_THINLTO=0"
"-DUSE_UNWIND=1"
"-DENABLE_NURAFT=1"
@ -370,6 +370,9 @@ function run_tests
# Depends on AWS
01801_s3_cluster
# Depents on LLVM JIT
01852_jit_if
)
(time clickhouse-test --hung-check -j 8 --order=random --use-skip-list --no-long --testname --shard --zookeeper --skip "${TESTS_TO_SKIP[@]}" -- "$FASTTEST_FOCUS" 2>&1 ||:) | ts '%Y-%m-%d %H:%M:%S' | tee "$FASTTEST_OUTPUT/test_log.txt"

View File

@ -329,6 +329,8 @@
-->
<mmap_cache_size>1000</mmap_cache_size>
<!-- Cache size for compiled expressions.-->
<compiled_expression_cache_size>1073741824<compiled_expression_cache_size>
<!-- Path to data directory, with trailing slash. -->
<path>/var/lib/clickhouse/</path>

View File

@ -181,13 +181,9 @@ const ActionsDAG::Node & ActionsDAG::addFunction(
node.function_builder = function;
node.children = std::move(children);
bool all_const = true;
ColumnsWithTypeAndName arguments(num_arguments);
/// There are function that can check argument column address and if we want to properly emulate execute
/// call it is important that column arguments from same node have equal address
std::unordered_map<const Node *, ColumnPtr> child_to_dummy_column;
child_to_dummy_column.reserve(num_arguments);
for (size_t i = 0; i < num_arguments; ++i)
{
const auto & child = *node.children[i];
@ -197,17 +193,8 @@ const ActionsDAG::Node & ActionsDAG::addFunction(
argument.type = child.result_type;
argument.name = child.result_name;
if (!argument.column)
{
auto it = child_to_dummy_column.find(&child);
if (it != child_to_dummy_column.end())
argument.column = it->second;
else
{
argument.column = argument.type->createColumn();
child_to_dummy_column[&child] = argument.column;
}
}
if (!argument.column || !isColumnConst(*argument.column))
all_const = false;
arguments[i] = std::move(argument);
}
@ -216,9 +203,8 @@ const ActionsDAG::Node & ActionsDAG::addFunction(
node.result_type = node.function_base->getResultType();
node.function = node.function_base->prepare(arguments);
/// There are function that can be constant event if they arguments are not
/// For examples greater(x0, x0) will return constant result.
if (node.function_base->isSuitableForConstantFolding())
/// If all arguments are constants, and function is suitable to be executed in 'prepare' stage - execute function.
if (all_const && node.function_base->isSuitableForConstantFolding())
{
size_t num_rows = arguments.empty() ? 0 : arguments.front().column->size();
auto col = node.function->execute(arguments, node.result_type, num_rows, true);