This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 127deb6d2a4 [Fix](Variant) fix array with predicate push down (#50969)
127deb6d2a4 is described below
commit 127deb6d2a456f96665aa8989d2e6cebd34e20b0
Author: lihangyu <[email protected]>
AuthorDate: Sat May 17 17:19:47 2025 +0800
[Fix](Variant) fix array with predicate push down (#50969)
Cherry-pick from https://github.com/apache/doris/pull/50934
---
be/src/olap/rowset/segment_v2/segment.h | 6 ++--
.../data/variant_p0/array_with_predicate.out | Bin 0 -> 261 bytes
.../suites/variant_p0/array_with_predicate.groovy | 37 +++++++++++++++++++++
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/segment.h
b/be/src/olap/rowset/segment_v2/segment.h
index b8e23629aca..671ac2aba43 100644
--- a/be/src/olap/rowset/segment_v2/segment.h
+++ b/be/src/olap/rowset/segment_v2/segment.h
@@ -189,9 +189,9 @@ public:
// Default column iterator
return true;
}
- if
(vectorized::WhichDataType(vectorized::remove_nullable(storage_column_type))
- .is_variant_type()) {
- // Predicate should nerver apply on variant type
+ auto nested_type = vectorized::remove_nullable(storage_column_type);
+ if (vectorized::is_variant_type(nested_type) ||
vectorized::is_complex_type(nested_type)) {
+ // Predicate should nerver apply on variant/complex type
return false;
}
bool safe =
diff --git a/regression-test/data/variant_p0/array_with_predicate.out
b/regression-test/data/variant_p0/array_with_predicate.out
new file mode 100644
index 00000000000..2afacefa0e1
Binary files /dev/null and
b/regression-test/data/variant_p0/array_with_predicate.out differ
diff --git a/regression-test/suites/variant_p0/array_with_predicate.groovy
b/regression-test/suites/variant_p0/array_with_predicate.groovy
new file mode 100644
index 00000000000..6c264411dda
--- /dev/null
+++ b/regression-test/suites/variant_p0/array_with_predicate.groovy
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// test array types with predicate
+suite("regression_test_variant_array_with_predicate", "p0"){
+ sql "DROP TABLE IF EXISTS array_with_predicate"
+ sql """
+ CREATE TABLE IF NOT EXISTS array_with_predicate (
+ k bigint,
+ v variant not null
+ )
+ DUPLICATE KEY(`k`)
+ DISTRIBUTED BY HASH(k) BUCKETS 1
+ properties("replication_num" = "1", "disable_auto_compaction" =
"false");
+ """
+ sql """insert into array_with_predicate values (1, '{"arr" : ["1", "2",
"3", "4"]}')"""
+ sql """insert into array_with_predicate values (1, '{"arr" : "[]"}')"""
+ sql """insert into array_with_predicate values (1, '{"arr1" : "[]"}')"""
+ qt_sql """select * from array_with_predicate where cast(v['arr'] as
array<text>) is not null"""
+ qt_sql """select * from array_with_predicate where cast(v['arr'] as text)
is not null"""
+ qt_sql """select * from array_with_predicate where cast(v['arr'] as
array<text>) is null"""
+ qt_sql """select * from array_with_predicate where cast(v['arr'] as text)
is null"""
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]