XieJiann commented on code in PR #27006:
URL: https://github.com/apache/doris/pull/27006#discussion_r1405587597
##########
fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java:
##########
@@ -1060,7 +1060,13 @@ public static ScalarType getAssignmentCompatibleType(
if (t1.type == PrimitiveType.STRING || t2.type ==
PrimitiveType.STRING) {
return createStringType();
}
- return createVarcharType(Math.max(t1.len, t2.len));
+ int minLength = Math.min(t1.len, t2.len);
+ if (minLength < 0) {
+ // If < 0 which means max length, use firstly
+ return createVarcharType(minLength);
+ }
Review Comment:
```suggestion
if (t1.len < 0 || t2.len < 0) {
// If < 0 which means max length, use firstly
return createVarcharType(minLength);
}
```
##########
fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java:
##########
@@ -1060,7 +1060,13 @@ public static ScalarType getAssignmentCompatibleType(
if (t1.type == PrimitiveType.STRING || t2.type ==
PrimitiveType.STRING) {
return createStringType();
}
- return createVarcharType(Math.max(t1.len, t2.len));
+ int minLength = Math.min(t1.len, t2.len);
+ if (minLength < 0) {
+ // If < 0 which means max length, use firstly
+ return createVarcharType(minLength);
+ }
Review Comment:
```suggestion
if (t1.len < 0 || t2.len < 0) {
// If < 0 which means max length, use firstly
return createVarcharType(minLength);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]