diff --git a/dbms/src/Functions/FunctionsLogical.h b/dbms/src/Functions/FunctionsLogical.h index 0adfd699b7e..ef508ced229 100644 --- a/dbms/src/Functions/FunctionsLogical.h +++ b/dbms/src/Functions/FunctionsLogical.h @@ -151,7 +151,7 @@ struct NotImpl { using ResultType = UInt8; - static inline UInt8 apply(A a) + static inline bool apply(A a) { return !a; } @@ -194,7 +194,7 @@ struct AssociativeOperationImpl {} /// Returns a combination of values in the i-th row of all columns stored in the constructor. - inline UInt8 apply(size_t i) const + inline bool apply(size_t i) const { if (Op::isSaturable()) { @@ -238,7 +238,7 @@ struct AssociativeOperationImpl : vec(in[in.size() - 1]->getData()) {} - inline UInt8 apply(size_t i) const + inline bool apply(size_t i) const { return vec[i]; } diff --git a/dbms/src/Functions/tests/gtest_logical.cpp b/dbms/src/Functions/tests/gtest_logical.cpp index a5bde6ccd2d..b4e9fb7541f 100644 --- a/dbms/src/Functions/tests/gtest_logical.cpp +++ b/dbms/src/Functions/tests/gtest_logical.cpp @@ -58,6 +58,20 @@ try func_name, createOnlyNullColumnConst(2), createColumn>({1, 0}))); + // issue 6127 + ASSERT_COLUMN_EQ( + createColumn({0, 1, 0, 0}), + executeFunction( + func_name, + createColumn({0, 123, 0, 41}), + createColumn({0, 11, 221, 0}))); + // issue 6127, position of UInt8 column may affect the result + ASSERT_COLUMN_EQ( + createColumn({0, 1, 0, 0}), + executeFunction( + func_name, + createColumn({0, 123, 0, 41}), + createColumn({0, 11, 221, 0}))); } CATCH @@ -73,13 +87,6 @@ try func_name, createColumn>({0, 1, 0, 1, {}, 0}), createColumn>({0, 1, 1, 0, 1, {}}))); - // issue 5849 - ASSERT_COLUMN_EQ( - createColumn({0, 1, 1, 1}), - executeFunction( - func_name, - createColumn({0, 123, 0, 41}), - createColumn({0, 11, 221, 0}))); // column, const ASSERT_COLUMN_EQ( createColumn>({1, 1}), @@ -101,6 +108,13 @@ try func_name, createOnlyNullColumnConst(2), createColumn>({1, 0}))); + // issue 5849 + ASSERT_COLUMN_EQ( + createColumn({0, 1, 1, 1}), + executeFunction( + func_name, + createColumn({0, 123, 0, 41}), + createColumn({0, 11, 221, 0}))); } CATCH