This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 e3f901eb97c [fix](In-predicate) fix bug for In-predicate, when in
predicate contains both SlotRef and Constant (#60302)
e3f901eb97c is described below
commit e3f901eb97c39f403724bd13c2298f89a7bf7e16
Author: minghong <[email protected]>
AuthorDate: Wed Jan 28 20:03:41 2026 +0800
[fix](In-predicate) fix bug for In-predicate, when in predicate contains
both SlotRef and Constant (#60302)
### What problem does this PR solve?
当in predicate 里同时包含常量和列时,计算出错
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
be/src/vec/exprs/vin_predicate.cpp | 3 +-
.../data/query_p0/in_predicate/inPredicate.out | 4 ++
.../query_p0/in_predicate/inPredicate.groovy | 43 ++++++++++++++++++++++
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/exprs/vin_predicate.cpp
b/be/src/vec/exprs/vin_predicate.cpp
index 3f272abeac8..68481ae9295 100644
--- a/be/src/vec/exprs/vin_predicate.cpp
+++ b/be/src/vec/exprs/vin_predicate.cpp
@@ -130,7 +130,8 @@ Status VInPredicate::execute_column(VExprContext* context,
const Block* block, s
// Here, _children[0] is colA
const size_t args_size = _is_args_all_constant ? 1 : _children.size();
- ColumnNumbers arguments(args_size);
+ ColumnNumbers arguments;
+ arguments.reserve(args_size);
Block temp_block;
for (int i = 0; i < args_size; ++i) {
ColumnPtr column;
diff --git a/regression-test/data/query_p0/in_predicate/inPredicate.out
b/regression-test/data/query_p0/in_predicate/inPredicate.out
new file mode 100644
index 00000000000..6bd50c0a9fe
--- /dev/null
+++ b/regression-test/data/query_p0/in_predicate/inPredicate.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !in_predicate_with_column_and_const --
+7 false false
+
diff --git a/regression-test/suites/query_p0/in_predicate/inPredicate.groovy
b/regression-test/suites/query_p0/in_predicate/inPredicate.groovy
new file mode 100644
index 00000000000..1a503c06482
--- /dev/null
+++ b/regression-test/suites/query_p0/in_predicate/inPredicate.groovy
@@ -0,0 +1,43 @@
+// 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.
+
+// The cases is copied from https://github.com/trinodb/trino/tree/master
+//
/testing/trino-product-tests/src/main/resources/sql-tests/testcases/aggregate
+// and modified by Doris.
+suite("inPredicate") {
+ sql """
+ set debug_skip_fold_constant=true;
+
+ create table t
+ (
+ id int,
+ name string
+ )
+ duplicate key (id)
+ distributed by hash(id) buckets 3
+ properties("replication_num" = "1");
+
+ insert into t values (7, 'bbb');
+ """
+
+ qt_in_predicate_with_column_and_const """
+ select id as x1,
+ id in (6, 2 + 0.3) as x2,
+ id in (6, 2 + 0.3) as x3
+ from t;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]