This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-1.2-unstable in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-unstable by this push: new 6b27d29e68 [Bug](predicate) fix core dump on bool type runtime filter (#13417) 6b27d29e68 is described below commit 6b27d29e684b540e4284a942f6d16f894cc14d69 Author: Pxl <pxl...@qq.com> AuthorDate: Fri Oct 21 13:15:22 2022 +0800 [Bug](predicate) fix core dump on bool type runtime filter (#13417) fix core dump on bool type runtime filter --- be/src/exprs/runtime_filter.cpp | 2 +- be/src/olap/in_list_predicate.h | 6 +++++- be/src/olap/predicate_creator.h | 5 ----- .../java/org/apache/doris/planner/RuntimeFilter.java | 6 +++--- .../data/query/operator/test_logical_operators.out | 19 +++++++++++++++++++ .../query/operator/test_logical_operators.groovy | 4 +++- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp index 24e8e41a84..540e814633 100644 --- a/be/src/exprs/runtime_filter.cpp +++ b/be/src/exprs/runtime_filter.cpp @@ -1413,7 +1413,7 @@ void IRuntimeFilter::to_protobuf(PInFilter* filter) { switch (column_type) { case TYPE_BOOLEAN: { - batch_copy<int32_t>(filter, it, [](PColumnValue* column, const int32_t* value) { + batch_copy<bool>(filter, it, [](PColumnValue* column, const bool* value) { column->set_boolval(*value); }); return; diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h index b0b9fc5330..3cd60c8f7e 100644 --- a/be/src/olap/in_list_predicate.h +++ b/be/src/olap/in_list_predicate.h @@ -27,6 +27,7 @@ #include "olap/column_predicate.h" #include "olap/rowset/segment_v2/bloom_filter.h" #include "olap/wrapper_field.h" +#include "runtime/define_primitive_type.h" #include "runtime/string_value.h" #include "runtime/type_limit.h" #include "uint24.h" @@ -267,7 +268,10 @@ public: private: template <typename LeftT, typename RightT> bool _operator(const LeftT& lhs, const RightT& rhs) const { - if constexpr (PT == PredicateType::IN_LIST) { + if constexpr (Type == TYPE_BOOLEAN) { + DCHECK(_values.size() == 2); + return PT == PredicateType::IN_LIST; + } else if constexpr (PT == PredicateType::IN_LIST) { return lhs != rhs; } return lhs == rhs; diff --git a/be/src/olap/predicate_creator.h b/be/src/olap/predicate_creator.h index ad1ed0d69e..0b1e1a4c14 100644 --- a/be/src/olap/predicate_creator.h +++ b/be/src/olap/predicate_creator.h @@ -24,7 +24,6 @@ #include "olap/in_list_predicate.h" #include "olap/null_predicate.h" #include "olap/tablet_schema.h" -#include "runtime/type_limit.h" #include "util/date_func.h" #include "util/string_util.h" @@ -236,10 +235,6 @@ template <PredicateType PT> inline ColumnPredicate* create_list_predicate(const TabletColumn& column, int index, const std::vector<std::string>& conditions, bool opposite, MemPool* pool) { - if (column.type() == OLAP_FIELD_TYPE_BOOL) { - LOG(FATAL) << "Failed to create list preacate! input column type is invalid"; - return nullptr; - } static_assert(PredicateTypeTraits::is_list(PT)); return create_predicate<PT, std::vector<std::string>>(column, index, conditions, opposite, pool); diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java b/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java index 45a0c60724..c3fec43021 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java @@ -26,8 +26,8 @@ import org.apache.doris.analysis.SlotRef; import org.apache.doris.analysis.TupleDescriptor; import org.apache.doris.analysis.TupleId; import org.apache.doris.analysis.TupleIsNullPredicate; -import org.apache.doris.catalog.PrimitiveType; import org.apache.doris.catalog.ScalarType; +import org.apache.doris.catalog.Type; import org.apache.doris.common.FeConstants; import org.apache.doris.common.IdGenerator; import org.apache.doris.qe.ConnectContext; @@ -264,8 +264,8 @@ public final class RuntimeFilter { TupleIsNullPredicate.unwrapExpr(normalizedJoinConjunct.getChild(0).clone()); Expr srcExpr = normalizedJoinConjunct.getChild(1); - if (srcExpr.getType().equals(ScalarType.createHllType()) - || srcExpr.getType().equals(ScalarType.createType(PrimitiveType.BITMAP))) { + Type srcType = srcExpr.getType(); + if (srcType.equals(ScalarType.HLL) || srcType.equals(ScalarType.BITMAP) || srcType.equals(ScalarType.BOOLEAN)) { return null; } diff --git a/regression-test/data/query/operator/test_logical_operators.out b/regression-test/data/query/operator/test_logical_operators.out index 17f680e079..55b4bfe63c 100644 --- a/regression-test/data/query/operator/test_logical_operators.out +++ b/regression-test/data/query/operator/test_logical_operators.out @@ -367,3 +367,22 @@ -- !logical_op10 -- false 1 1989 1001 11011902 123.123 true 1989-03-21 1989-03-21T13:00 wangjuoo4 0.1 6.333 string12345 170141183460469231731687303715884105727 +-- !logical_op11 -- +false 1 1989 1001 11011902 123.123 true 1989-03-21 1989-03-21T13:00 wangjuoo4 0.1 6.333 string12345 170141183460469231731687303715884105727 +false 2 1986 1001 11011903 1243.5 false 1901-12-31 1989-03-21T13:00 wangynnsf 20.268 789.25 string12345 -170141183460469231731687303715884105727 +false 3 1989 1002 11011905 24453.325 false 2012-03-14 2000-01-01T00:00 yunlj8@nk 78945.0 3654.0 string12345 0 +false 4 1991 3021 -11011907 243243.325 false 3124-10-10 2015-03-13T10:30 yanvjldjlll 2.06 -0.001 string12345 20220101 +false 5 1985 5014 -11011903 243.325 true 2015-01-01 2015-03-13T12:36:38 du3lnvl -0.0 -365.0 string12345 20220102 +false 6 32767 3021 123456 604587 true 2014-11-11 2015-03-13T12:36:38 yanavnd 0.1 80699.0 string12345 20220104 +false 7 -32767 1002 7210457 3.141 false 1988-03-21 1901-01-01T00:00 jiw3n4 0.0 6058.0 string12345 -20220101 +true 8 255 2147483647 11011920 -0.123 true 1989-03-21 9999-11-11T12:12 wangjuoo5 987456.123 12.14 string12345 -2022 +true 9 1991 -2147483647 11011902 -654.654 true 1991-08-11 1989-03-21T13:11 wangjuoo4 0.0 69.123 string12345 11011903 +true 10 1991 5014 9223372036854775807 -258.369 false 2015-04-02 2013-04-02T15:16:52 wangynnsf -123456.54 0.235 string12345 -11011903 +true 11 1989 25699 -9223372036854775807 0.666 true 2015-04-02 1989-03-21T13:11 yunlj8@nk -987.001 4.336 string12345 1701411834604692317316873037158 +true 12 32767 -2147483647 9223372036854775807 243.325 false 1991-08-11 2013-04-02T15:16:52 lifsno -564.898 3.1415927 string12345 1701604692317316873037158 +true 13 -32767 2147483647 -9223372036854775807 100.001 false 2015-04-02 2015-04-02T00:00 wenlsfnl 123.456 3.1415927 string12345 701411834604692317316873037158 +true 14 255 103 11011902 0 false 2015-04-02 2015-04-02T00:00 3.141592654 2.036 string12345 701411834604692317316873 +true 15 1992 3021 11011920 0 true 9999-12-12 2015-04-02T00:00 3.141592653 20.456 string12345 701411834604692317 + +-- !logical_op12 -- + diff --git a/regression-test/suites/query/operator/test_logical_operators.groovy b/regression-test/suites/query/operator/test_logical_operators.groovy index 5164b4f94f..e5dfe498d7 100644 --- a/regression-test/suites/query/operator/test_logical_operators.groovy +++ b/regression-test/suites/query/operator/test_logical_operators.groovy @@ -36,5 +36,7 @@ suite("test_logical_operators", "query,p0") { } } qt_logical_op9 "select k8, k9, k8%k9, k9%NULL, NULL%k9 from ${tableName} order by 1, 2" - qt_logical_op10 'select * from baseall where (k1 = 1) or (k1 = 1 and k2 = 2)' + qt_logical_op10 'select * from baseall where (k1 = 1) or (k1 = 1 and k2 = 2) order by k1, k2, k3, k4' + qt_logical_op11 'select * from baseall where k0 in (false,true) order by k1, k2, k3, k4' + qt_logical_op12 'select * from baseall where k0 not in (false,true) order by k1, k2, k3, k4' } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org