This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 9db5389d90d branch-4.0: [opt](partition) remove castTo in PartitionKey 
comparison #57518 (#57547)
9db5389d90d is described below

commit 9db5389d90d2e20ffee9341ad5134565ff0becaf
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 5 11:51:16 2025 +0800

    branch-4.0: [opt](partition) remove castTo in PartitionKey comparison 
#57518 (#57547)
    
    Cherry-picked from #57518
    
    Co-authored-by: morrySnow <[email protected]>
---
 .../java/org/apache/doris/catalog/PartitionKey.java    | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
index 091f9ed304f..59408288f6d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java
@@ -32,7 +32,6 @@ import 
org.apache.doris.nereids.trees.expressions.literal.DateTimeLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal;
 import org.apache.doris.nereids.trees.expressions.literal.Literal;
 import org.apache.doris.persist.gson.GsonUtils;
-import org.apache.doris.qe.SessionVariable;
 
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
@@ -270,22 +269,7 @@ public class PartitionKey implements 
Comparable<PartitionKey>, Writable {
         if (key1 instanceof MaxLiteral || key2 instanceof MaxLiteral) {
             ret = key1.compareLiteral(key2);
         } else {
-            boolean enableDecimal256 = SessionVariable.getEnableDecimal256();
-            final Type destType = 
Type.getAssignmentCompatibleType(key1.getType(), key2.getType(), false,
-                    enableDecimal256);
-            try {
-                LiteralExpr newKey = key1;
-                if (key1.getType() != destType) {
-                    newKey = (LiteralExpr) key1.castTo(destType);
-                }
-                LiteralExpr newOtherKey = key2;
-                if (key2.getType() != destType) {
-                    newOtherKey = (LiteralExpr) key2.castTo(destType);
-                }
-                ret = newKey.compareLiteral(newOtherKey);
-            } catch (AnalysisException e) {
-                throw new RuntimeException("Cast error in partition");
-            }
+            ret = key1.compareLiteral(key2);
         }
         return ret;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to