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 d5115a21b54 [pick](ShortCircuit) Conjuncts outof key columns's order should be handled (#41071) d5115a21b54 is described below commit d5115a21b54bd3e779fe63f6eb9eaebe7bd36bac Author: lihangyu <15605149...@163.com> AuthorDate: Sat Sep 21 20:34:05 2024 +0800 [pick](ShortCircuit) Conjuncts outof key columns's order should be handled (#41071) #37900 --- .../main/java/org/apache/doris/qe/PointQueryExecutor.java | 14 +++++++++----- regression-test/data/point_query_p0/test_point_query.out | 3 +++ .../suites/point_query_p0/test_point_query.groovy | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java index 13f6ec2a965..72a5a8e66a8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java @@ -44,6 +44,7 @@ import org.apache.doris.thrift.TStatusCode; import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import com.google.common.collect.Maps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.thrift.TDeserializer; @@ -53,6 +54,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -148,16 +150,18 @@ public class PointQueryExecutor implements CoordInterface { void addKeyTuples( InternalService.PTabletKeyLookupRequest.Builder requestBuilder) { // TODO handle IN predicates + Map<String, Expr> columnExpr = Maps.newHashMap(); KeyTuple.Builder kBuilder = KeyTuple.newBuilder(); for (Expr expr : shortCircuitQueryContext.scanNode.getConjuncts()) { BinaryPredicate predicate = (BinaryPredicate) expr; Expr left = predicate.getChild(0); Expr right = predicate.getChild(1); - // ignore delete sign conjuncts only collect key conjuncts - if (left instanceof SlotRef && ((SlotRef) left).getColumnName().equalsIgnoreCase(Column.DELETE_SIGN)) { - continue; - } - kBuilder.addKeyColumnRep(right.getStringValue()); + SlotRef columnSlot = left.unwrapSlotRef(); + columnExpr.put(columnSlot.getColumnName(), right); + } + // add key tuple in keys order + for (Column column : shortCircuitQueryContext.scanNode.getOlapTable().getBaseSchemaKeyColumns()) { + kBuilder.addKeyColumnRep(columnExpr.get(column.getName()).getStringValue()); } requestBuilder.addKeyTuples(kBuilder); } diff --git a/regression-test/data/point_query_p0/test_point_query.out b/regression-test/data/point_query_p0/test_point_query.out index 1cc4142e39f..3003a098a5b 100644 --- a/regression-test/data/point_query_p0/test_point_query.out +++ b/regression-test/data/point_query_p0/test_point_query.out @@ -160,3 +160,6 @@ -- !sql -- -10 20 aabc update val +-- !sql -- +-10 20 aabc update val + diff --git a/regression-test/suites/point_query_p0/test_point_query.groovy b/regression-test/suites/point_query_p0/test_point_query.groovy index a1cbeba4817..902c6ffa955 100644 --- a/regression-test/suites/point_query_p0/test_point_query.groovy +++ b/regression-test/suites/point_query_p0/test_point_query.groovy @@ -330,4 +330,5 @@ suite("test_point_query", "nonConcurrent") { qt_sql "select * from table_3821461 where col1 = 10 and col2 = 20 and loc3 = 'aabc';" sql "update table_3821461 set value = 'update value' where col1 = -10 or col1 = 20;" qt_sql """select * from table_3821461 where col1 = -10 and col2 = 20 and loc3 = 'aabc'""" + qt_sql """select * from table_3821461 where col2 = 20 and loc3 = 'aabc' and col1 = -10 """ } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org