You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/07/24 14:01:16 UTC
[doris] 14/21: [fix](in) throw exception for unsupported data type of in expr (#22050)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3a710117b860d23fd92c122ee8b588779124df57
Author: TengJianPing <18...@users.noreply.github.com>
AuthorDate: Mon Jul 24 14:13:31 2023 +0800
[fix](in) throw exception for unsupported data type of in expr (#22050)
---
be/src/exprs/create_predicate_function.h | 3 +-
be/src/vec/columns/column_complex.h | 3 +-
.../query_p0/sql_functions/test_in_expr.groovy | 85 ++++++++++++++++++++++
3 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/be/src/exprs/create_predicate_function.h b/be/src/exprs/create_predicate_function.h
index 4bc9328323..93ed3a459b 100644
--- a/be/src/exprs/create_predicate_function.h
+++ b/be/src/exprs/create_predicate_function.h
@@ -125,7 +125,8 @@ typename Traits::BasePtr create_predicate_function(PrimitiveType type) {
APPLY_FOR_PRIMTYPE(M)
#undef M
default:
- DCHECK(false) << "Invalid type: " << type_to_string(type);
+ throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
+ "predicate with type " + type_to_string(type));
}
return nullptr;
diff --git a/be/src/vec/columns/column_complex.h b/be/src/vec/columns/column_complex.h
index 211de96df6..81cd6a45cb 100644
--- a/be/src/vec/columns/column_complex.h
+++ b/be/src/vec/columns/column_complex.h
@@ -235,7 +235,8 @@ public:
[[noreturn]] int compare_at(size_t n, size_t m, const IColumn& rhs,
int nan_direction_hint) const override {
- LOG(FATAL) << "compare_at not implemented";
+ throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
+ "compare_at for " + std::string(get_family_name()));
}
void get_extremes(Field& min, Field& max) const override {
diff --git a/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy b/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
index 4d37566020..cdaaa64126 100644
--- a/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
+++ b/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
@@ -130,4 +130,89 @@ suite("test_in_expr", "query") {
qt_select """
SELECT CASE (TIMESTAMP '1970-12-04 03:51:34' NOT BETWEEN TIMESTAMP '1970-11-11 16:41:26' AND TIMESTAMP 'CURRENT_TIMESTAMP') WHEN (0.7532032132148743 BETWEEN 0.7817240953445435 AND CAST('.' AS FLOAT) ) THEN (- (- 2093562249)) WHEN CAST((true IN (false)) AS BOOLEAN) THEN (+ 1351956476) END FROM t11 WHERE (NULL IN (CASE CAST('-658171195' AS BOOLEAN) WHEN ((TIMESTAMP '1970-02-25 22:11:59') IS NOT NULL) THEN NULL WHEN ((true) IS NULL) THEN NULL END )) GROUP BY t11.c0 ORDER BY 1;
"""
+
+ sql " drop table if exists `array_in_test` "
+ sql """
+ CREATE TABLE `array_in_test` (
+ `id` int(11) NULL COMMENT "",
+ `c_array` ARRAY<int(11)> NULL COMMENT ""
+ )
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ sql """ INSERT INTO `array_in_test` VALUES (1, [1,2,3,4,5]); """
+
+ test {
+ sql """ select c_array, c_array in (null) from array_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+
+ sql " drop table if exists `json_in_test` "
+ sql """
+ CREATE TABLE json_in_test (
+ id INT,
+ j JSON
+ )
+ DUPLICATE KEY(id)
+ DISTRIBUTED BY HASH(id) BUCKETS 10
+ PROPERTIES("replication_num" = "1");
+ """
+
+ sql """ INSERT INTO json_in_test VALUES(26, '{"k1":"v1", "k2": 200}'); """
+
+ test {
+ sql """ select j, j in (null) from json_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+
+ sql " drop table if exists `bitmap_in_test` "
+ sql """
+ create table bitmap_in_test (
+ datekey int,
+ hour int,
+ device_id bitmap BITMAP_UNION
+ )
+ aggregate key (datekey, hour)
+ distributed by hash(datekey, hour) buckets 1
+ properties(
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ insert into bitmap_in_test values (20200622, 1, to_bitmap(243));"""
+ test {
+ sql """ select device_id, device_id in (to_bitmap(1)) from bitmap_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+ test {
+ sql """ select device_id, device_id in (to_bitmap(1),to_bitmap(2),to_bitmap(243)) from bitmap_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+
+ sql " drop table if exists `hll_in_test` "
+ sql """
+ create table hll_in_test (
+ id int,
+ pv hll hll_union
+ )
+ Aggregate KEY (id)
+ distributed by hash(id) buckets 10
+ PROPERTIES(
+ "replication_num" = "1"
+ )
+ """
+
+ sql """ insert into hll_in_test values(1, hll_hash(1)) """
+ test {
+ sql """ select id, pv in (hll_hash(1)) from hll_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+ test {
+ sql """ select id, pv in (hll_hash(1), hll_hash(2)) from hll_in_test; """
+ exception "NOT_IMPLEMENTED_ERROR"
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org