This is an automated email from the ASF dual-hosted git repository.
Gabriel39 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6c6b72924b2 [fix](maxcompute)Fix MaxCompute IN predicate pushdown
polarity. (#65083)
6c6b72924b2 is described below
commit 6c6b72924b269cda200beeb1c62f5f2184e78715
Author: daidai <[email protected]>
AuthorDate: Mon Jul 6 14:17:19 2026 +0800
[fix](maxcompute)Fix MaxCompute IN predicate pushdown polarity. (#65083)
fix maxcompute error in predicate pushdown.
---
.../maxcompute/source/MaxComputeScanNode.java | 4 +-
.../test_max_compute_in_predicate_pushdown.out | 24 +++++
.../test_max_compute_in_predicate_pushdown.groovy | 102 +++++++++++++++++++++
3 files changed, 128 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
index ae297d99c44..7df4203988f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
@@ -408,8 +408,8 @@ public class MaxComputeScanNode extends FileQueryScanNode {
InPredicate inPredicate = (InPredicate) expr;
com.aliyun.odps.table.optimizer.predicate.InPredicate.Operator
odpsOp =
inPredicate.isNotIn()
- ?
com.aliyun.odps.table.optimizer.predicate.InPredicate.Operator.IN
- :
com.aliyun.odps.table.optimizer.predicate.InPredicate.Operator.NOT_IN;
+ ?
com.aliyun.odps.table.optimizer.predicate.InPredicate.Operator.NOT_IN
+ :
com.aliyun.odps.table.optimizer.predicate.InPredicate.Operator.IN;
String columnName = convertSlotRefToColumnName(expr.getChild(0));
if (!table.getColumnNameToOdpsColumn().containsKey(columnName)) {
diff --git
a/regression-test/data/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.out
b/regression-test/data/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.out
new file mode 100644
index 00000000000..14738e901b2
--- /dev/null
+++
b/regression-test/data/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.out
@@ -0,0 +1,24 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !in_single --
+1 str
+3 str
+
+-- !in_multi --
+1 str
+2 string_value
+3 str
+4 string_value
+
+-- !not_in_single --
+2 string_value
+4 string_value
+
+-- !not_in_multi --
+
+-- !in_non_pushdown --
+1 str
+3 str
+
+-- !not_in_non_pushdown --
+2 string_value
+4 string_value
diff --git
a/regression-test/suites/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.groovy
b/regression-test/suites/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.groovy
new file mode 100644
index 00000000000..3e7cc353ac6
--- /dev/null
+++
b/regression-test/suites/external_table_p2/maxcompute/test_max_compute_in_predicate_pushdown.groovy
@@ -0,0 +1,102 @@
+// 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.
+
+suite("test_max_compute_in_predicate_pushdown",
"p2,external,maxcompute,external_remote,external_remote_maxcompute") {
+ String enabled = context.config.otherConfigs.get("enableMaxComputeTest")
+ if (enabled != null && enabled.equalsIgnoreCase("true")) {
+ String ak = context.config.otherConfigs.get("ak")
+ String sk = context.config.otherConfigs.get("sk")
+ String mcCatalogName = "test_max_compute_in_predicate_pushdown"
+ String defaultProject = "mc_datalake"
+ String tableName = "mc_all_types"
+
+ sql """drop catalog if exists ${mcCatalogName} """
+ sql """
+ create catalog if not exists ${mcCatalogName} properties (
+ "type" = "max_compute",
+ "mc.default.project" = "${defaultProject}",
+ "mc.access_key" = "${ak}",
+ "mc.secret_key" = "${sk}",
+ "mc.endpoint" =
"http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api",
+ "mc.quota" = "pay-as-you-go"
+ );
+ """
+
+ sql """switch ${mcCatalogName};"""
+ sql """use ${defaultProject};"""
+
+ def pushdownInSingle = sql """
+ select id, string_col from ${tableName}
+ where string_col in ("str")
+ order by id
+ """
+ def localInSingle = sql """
+ select id, string_col from ${tableName}
+ where concat(string_col, "") in ("str")
+ order by id
+ """
+ assertEquals(localInSingle, pushdownInSingle)
+
+ def pushdownNotInSingle = sql """
+ select id, string_col from ${tableName}
+ where string_col not in ("str")
+ order by id
+ """
+ def localNotInSingle = sql """
+ select id, string_col from ${tableName}
+ where concat(string_col, "") not in ("str")
+ order by id
+ """
+ assertEquals(localNotInSingle, pushdownNotInSingle)
+
+ order_qt_in_single """
+ select id, string_col from ${tableName}
+ where string_col in ("str")
+ order by id
+ """
+
+ order_qt_in_multi """
+ select id, string_col from ${tableName}
+ where string_col in ("str", "string_value")
+ order by id
+ """
+
+ order_qt_not_in_single """
+ select id, string_col from ${tableName}
+ where string_col not in ("str")
+ order by id
+ """
+
+ order_qt_not_in_multi """
+ select id, string_col from ${tableName}
+ where string_col not in ("str", "string_value")
+ order by id
+ """
+
+ order_qt_in_non_pushdown """
+ select id, string_col from ${tableName}
+ where concat(string_col, "") in ("str")
+ order by id
+ """
+
+ order_qt_not_in_non_pushdown """
+ select id, string_col from ${tableName}
+ where concat(string_col, "") not in ("str")
+ order by id
+ """
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]