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 65551d9006f branch-4.0: [fix](nereids)varchar(-1) and varchar(65533) 
should be treated as the same data type #57176 (#57566)
65551d9006f is described below

commit 65551d9006f3d53b932b5bd5731001e0eb73dddb
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Nov 3 11:09:18 2025 +0800

    branch-4.0: [fix](nereids)varchar(-1) and varchar(65533) should be treated 
as the same data type #57176 (#57566)
    
    Cherry-picked from #57176
    
    Co-authored-by: starocean999 <[email protected]>
---
 .../src/main/java/org/apache/doris/nereids/types/VarcharType.java | 4 ++--
 .../test/java/org/apache/doris/nereids/types/DataTypeTest.java    | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/VarcharType.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/VarcharType.java
index 620d0de29c9..a23487162e6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/VarcharType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/VarcharType.java
@@ -84,12 +84,12 @@ public class VarcharType extends CharacterType {
             return false;
         }
         VarcharType that = (VarcharType) o;
-        return len == that.len;
+        return len == that.len || (isWildcardVarchar() && 
that.isWildcardVarchar());
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(super.hashCode(), len);
+        return Objects.hash(super.hashCode(), len == -1 ? MAX_VARCHAR_LENGTH : 
len);
     }
 
     public boolean isWildcardVarchar() {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java
index 5793ff8e4bc..ccf1f9281c9 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java
@@ -54,10 +54,18 @@ public class DataTypeTest {
         VarcharType varcharType1 = new VarcharType(32);
         VarcharType varcharType2 = new VarcharType(32);
         VarcharType varcharType3 = new VarcharType(64);
+        VarcharType varcharType4 = new VarcharType(-1);
+        VarcharType varcharType5 = new VarcharType(65533);
         Assertions.assertEquals(varcharType1, varcharType2);
         Assertions.assertEquals(varcharType1.hashCode(), 
varcharType2.hashCode());
         Assertions.assertNotEquals(varcharType1, varcharType3);
         Assertions.assertNotEquals(varcharType1.hashCode(), 
varcharType3.hashCode());
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT, 
VarcharType.MAX_VARCHAR_TYPE);
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT.hashCode(), 
VarcharType.MAX_VARCHAR_TYPE.hashCode());
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT, varcharType4);
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT.hashCode(), 
varcharType4.hashCode());
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT, varcharType5);
+        Assertions.assertEquals(VarcharType.SYSTEM_DEFAULT.hashCode(), 
varcharType5.hashCode());
     }
 
     @Test


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

Reply via email to