diff --git a/dbms/src/Functions/FunctionsLogical.h b/dbms/src/Functions/FunctionsLogical.h index 7f1813dd219..54f619cb935 100644 --- a/dbms/src/Functions/FunctionsLogical.h +++ b/dbms/src/Functions/FunctionsLogical.h @@ -137,7 +137,7 @@ struct NotImpl { using ResultType = UInt8; - static inline UInt8 apply(A a) + static inline bool apply(A a) { return !a; } @@ -180,7 +180,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()) { @@ -224,7 +224,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 a536f07aac5..bd48b620607 100644 --- a/dbms/src/Functions/tests/gtest_logical.cpp +++ b/dbms/src/Functions/tests/gtest_logical.cpp @@ -44,6 +44,20 @@ try func_name, createOnlyNullColumn(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 @@ -59,13 +73,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}), @@ -87,6 +94,13 @@ try func_name, createOnlyNullColumn(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