From 1d0bee7deeccf59f59179708e2508d49adc8de6f Mon Sep 17 00:00:00 2001 From: chertus Date: Mon, 21 Jan 2019 22:56:11 +0300 Subject: [PATCH] fix collecting required columns in lambda --- dbms/src/Interpreters/RequiredSourceColumnsVisitor.cpp | 2 +- .../queries/0_stateless/00819_ast_refactoring_bugs.reference | 0 .../tests/queries/0_stateless/00819_ast_refactoring_bugs.sql | 5 +++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.reference create mode 100644 dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.sql diff --git a/dbms/src/Interpreters/RequiredSourceColumnsVisitor.cpp b/dbms/src/Interpreters/RequiredSourceColumnsVisitor.cpp index 7d93da95e8d..5dc479fee5e 100644 --- a/dbms/src/Interpreters/RequiredSourceColumnsVisitor.cpp +++ b/dbms/src/Interpreters/RequiredSourceColumnsVisitor.cpp @@ -157,7 +157,7 @@ void RequiredSourceColumnsMatcher::visit(const ASTFunction & node, const ASTPtr local_aliases.push_back(name); /// visit child with masked local aliases - visit(node.arguments->children[1], data); + RequiredSourceColumnsVisitor(data).visit(node.arguments->children[1]); for (const auto & name : local_aliases) data.private_aliases.erase(name); diff --git a/dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.reference b/dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.sql b/dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.sql new file mode 100644 index 00000000000..98ae13d2b9e --- /dev/null +++ b/dbms/tests/queries/0_stateless/00819_ast_refactoring_bugs.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS test.sign (Sign Int8, Arr Array(Int8)) ENGINE = Memory; + +SELECT arrayMap(x -> x * Sign, Arr) FROM test.sign; + +DROP TABLE test.sign;