You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/14 05:58:57 UTC
[doris] 01/12: [Bug](predicate) fix ccore dump on varchar with in list predicate (#14881)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 06d02b29d3af24b0a279291b9dad1bef6af44197
Author: Pxl <px...@qq.com>
AuthorDate: Thu Dec 8 17:14:23 2022 +0800
[Bug](predicate) fix ccore dump on varchar with in list predicate (#14881)
* fix ccore dump on varchar with in list predicate
* update case
* Update sqlsmith01.sql
---
be/src/olap/bitmap_filter_predicate.h | 3 ++-
be/src/olap/bloom_filter_predicate.h | 8 ++++++--
be/src/olap/comparison_predicate.h | 15 ++++++++-------
be/src/olap/in_list_predicate.h | 11 ++++-------
be/src/runtime/primitive_type.h | 3 +++
.../data/tpcds_sf1_unique_p1/sql/sqlsmith01.out | 3 +++
.../suites/tpcds_sf1_unique_p1/sql/sqlsmith01.sql | 1 +
7 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/be/src/olap/bitmap_filter_predicate.h b/be/src/olap/bitmap_filter_predicate.h
index 9bf444b889..a10bf46f7b 100644
--- a/be/src/olap/bitmap_filter_predicate.h
+++ b/be/src/olap/bitmap_filter_predicate.h
@@ -93,7 +93,8 @@ private:
uint16_t new_size = 0;
new_size = _specific_filter->find_fixed_len_olap_engine(
- (char*)reinterpret_cast<const vectorized::PredicateColumnType<T>*>(&column)
+ (char*)reinterpret_cast<
+ const vectorized::PredicateColumnType<PredicateEvaluateType<T>>*>(&column)
->get_data()
.data(),
null_map, sel, size);
diff --git a/be/src/olap/bloom_filter_predicate.h b/be/src/olap/bloom_filter_predicate.h
index efa00a5930..a5fdcdd6ae 100644
--- a/be/src/olap/bloom_filter_predicate.h
+++ b/be/src/olap/bloom_filter_predicate.h
@@ -84,7 +84,9 @@ private:
}
} else if (IRuntimeFilter::enable_use_batch(_be_exec_version, T)) {
new_size = _specific_filter->find_fixed_len_olap_engine(
- (char*)reinterpret_cast<const vectorized::PredicateColumnType<T>*>(&column)
+ (char*)reinterpret_cast<
+ const vectorized::PredicateColumnType<PredicateEvaluateType<T>>*>(
+ &column)
->get_data()
.data(),
null_map, sel, size);
@@ -101,7 +103,9 @@ private:
};
auto pred_col_data =
- reinterpret_cast<const vectorized::PredicateColumnType<T>*>(&column)
+ reinterpret_cast<
+ const vectorized::PredicateColumnType<PredicateEvaluateType<T>>*>(
+ &column)
->get_data()
.data();
for (uint16_t i = 0; i < size; i++) {
diff --git a/be/src/olap/comparison_predicate.h b/be/src/olap/comparison_predicate.h
index 909f638813..8856fc4ade 100644
--- a/be/src/olap/comparison_predicate.h
+++ b/be/src/olap/comparison_predicate.h
@@ -345,8 +345,8 @@ public:
LOG(FATAL) << "column_dictionary must use StringValue predicate.";
}
} else {
- auto* data_array = reinterpret_cast<const vectorized::PredicateColumnType<Type>&>(
- nested_column)
+ auto* data_array = reinterpret_cast<const vectorized::PredicateColumnType<
+ PredicateEvaluateType<Type>>&>(nested_column)
.get_data()
.data();
@@ -368,7 +368,8 @@ public:
}
} else {
auto* data_array =
- vectorized::check_and_get_column<vectorized::PredicateColumnType<Type>>(
+ vectorized::check_and_get_column<
+ vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(
column)
->get_data()
.data();
@@ -546,7 +547,8 @@ private:
}
} else {
auto* data_array =
- vectorized::check_and_get_column<vectorized::PredicateColumnType<Type>>(column)
+ vectorized::check_and_get_column<
+ vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(column)
->get_data()
.data();
@@ -592,8 +594,8 @@ private:
}
} else {
auto* data_array =
- vectorized::check_and_get_column<vectorized::PredicateColumnType<EvalType>>(
- column)
+ vectorized::check_and_get_column<
+ vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(column)
->get_data()
.data();
@@ -608,7 +610,6 @@ private:
}
T _value;
- static constexpr PrimitiveType EvalType = (Type == TYPE_CHAR ? TYPE_STRING : Type);
};
} //namespace doris
diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h
index 503aa340b0..d1c0d2327a 100644
--- a/be/src/olap/in_list_predicate.h
+++ b/be/src/olap/in_list_predicate.h
@@ -496,9 +496,8 @@ private:
LOG(FATAL) << "column_dictionary must use StringValue predicate.";
}
} else {
- auto* nested_col_ptr =
- vectorized::check_and_get_column<vectorized::PredicateColumnType<EvalType>>(
- column);
+ auto* nested_col_ptr = vectorized::check_and_get_column<
+ vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(column);
auto& data_array = nested_col_ptr->get_data();
for (uint16_t i = 0; i < size; i++) {
@@ -573,9 +572,8 @@ private:
LOG(FATAL) << "column_dictionary must use StringValue predicate.";
}
} else {
- auto* nested_col_ptr =
- vectorized::check_and_get_column<vectorized::PredicateColumnType<EvalType>>(
- column);
+ auto* nested_col_ptr = vectorized::check_and_get_column<
+ vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(column);
auto& data_array = nested_col_ptr->get_data();
for (uint16_t i = 0; i < size; i++) {
@@ -630,7 +628,6 @@ private:
_segment_id_to_value_in_dict_flags;
T _min_value;
T _max_value;
- static constexpr PrimitiveType EvalType = (Type == TYPE_CHAR ? TYPE_STRING : Type);
// temp string for char type column
std::list<std::string> _temp_datas;
diff --git a/be/src/runtime/primitive_type.h b/be/src/runtime/primitive_type.h
index 4547333389..5af7639290 100644
--- a/be/src/runtime/primitive_type.h
+++ b/be/src/runtime/primitive_type.h
@@ -112,6 +112,9 @@ std::string type_to_odbc_string(PrimitiveType t);
TTypeDesc gen_type_desc(const TPrimitiveType::type val);
TTypeDesc gen_type_desc(const TPrimitiveType::type val, const std::string& name);
+template <PrimitiveType type>
+constexpr PrimitiveType PredicateEvaluateType = is_string_type(type) ? TYPE_STRING : type;
+
template <PrimitiveType type>
struct PrimitiveTypeTraits;
diff --git a/regression-test/data/tpcds_sf1_unique_p1/sql/sqlsmith01.out b/regression-test/data/tpcds_sf1_unique_p1/sql/sqlsmith01.out
new file mode 100644
index 0000000000..0eda0eedc9
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_unique_p1/sql/sqlsmith01.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sqlsmith01 --
+
diff --git a/regression-test/suites/tpcds_sf1_unique_p1/sql/sqlsmith01.sql b/regression-test/suites/tpcds_sf1_unique_p1/sql/sqlsmith01.sql
new file mode 100644
index 0000000000..c537884f00
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_unique_p1/sql/sqlsmith01.sql
@@ -0,0 +1 @@
+select /*+ SET_VAR(query_timeout = 600) */ ref_1.`i_product_name` as c0, ref_0.`i_category_id` as c1, ref_0.`i_formulation` as c2, ref_0.`i_manager_id` as c3, ref_0.`i_product_name` as c4, ref_1.`i_product_name` as c5, ref_0.`i_size` as c6, avg( cast(42 as int)) over (partition by ref_1.`i_product_name`,ref_1.`i_product_name` order by ref_1.`i_product_name`,ref_1.`i_product_name`) as c7, ref_0.`i_brand` as c8 from regression_test_tpcds_sf1_unique_p1.item as ref_0 inner join regression_te [...]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org