From ac1b69247ca80c855a3fa86e8a32b8f1b6556658 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 9 Nov 2017 22:24:49 +0300 Subject: [PATCH] Addition to prev. revision [#CLICKHOUSE-3402]. --- .../Functions/tests/logical_functions_performance.cpp | 1 - dbms/src/Storages/MergeTree/PKCondition.cpp | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dbms/src/Functions/tests/logical_functions_performance.cpp b/dbms/src/Functions/tests/logical_functions_performance.cpp index 946a2f2d44d..3aaf8430582 100644 --- a/dbms/src/Functions/tests/logical_functions_performance.cpp +++ b/dbms/src/Functions/tests/logical_functions_performance.cpp @@ -370,7 +370,6 @@ int main(int argc, char ** argv) for (size_t arity = 2; arity <= columns; ++arity) { FunctionPtr function = std::make_shared(); - function->getReturnType(DataTypes(arity, DataTypePtr(std::make_shared()))); ColumnNumbers arguments(arity); for (size_t i = 0; i < arity; ++i) diff --git a/dbms/src/Storages/MergeTree/PKCondition.cpp b/dbms/src/Storages/MergeTree/PKCondition.cpp index 1e5cef69ef9..b2a0e2e5146 100644 --- a/dbms/src/Storages/MergeTree/PKCondition.cpp +++ b/dbms/src/Storages/MergeTree/PKCondition.cpp @@ -307,11 +307,13 @@ static void applyFunction( const DataTypePtr & arg_type, const Field & arg_value, DataTypePtr & res_type, Field & res_value) { - res_type = func->getReturnType({arg_type}); + std::vector unused_prerequisites; + ColumnsWithTypeAndName arguments{{ arg_type->createConstColumn(1, arg_value), arg_type, "x" }}; + func->getReturnTypeAndPrerequisites(arguments, res_type, unused_prerequisites); Block block { - { arg_type->createConstColumn(1, arg_value), arg_type, "x" }, + arguments[0], { nullptr, res_type, "y" } }; @@ -435,7 +437,10 @@ bool PKCondition::isPrimaryKeyPossiblyWrappedByMonotonicFunctions( if (!func || !func->hasInformationAboutMonotonicity()) return false; - primary_key_column_type = func->getReturnType({primary_key_column_type}); + std::vector unused_prerequisites; + ColumnsWithTypeAndName arguments{{ nullptr, primary_key_column_type, "" }}; + func->getReturnTypeAndPrerequisites(arguments, primary_key_column_type, unused_prerequisites); + out_functions_chain.push_back(func); }