morrySnow commented on code in PR #14263:
URL: https://github.com/apache/doris/pull/14263#discussion_r1023469488


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -207,6 +210,22 @@ public static Optional<DataType> 
findTightestCommonType(DataType left, DataType
             tightestCommonType = 
DecimalV2Type.widerDecimalV2Type((DecimalV2Type) left, 
DecimalV2Type.forType(right));
         } else if (left instanceof IntegralType && right instanceof 
DecimalV2Type) {
             tightestCommonType = 
DecimalV2Type.widerDecimalV2Type((DecimalV2Type) right, 
DecimalV2Type.forType(left));
+        } else if (left instanceof DateLikeType && right instanceof 
DateLikeType) {
+            if (left instanceof DateTimeV2Type && right instanceof 
DateTimeV2Type) {
+                if (((DateTimeV2Type) left).getScale() > ((DateTimeV2Type) 
right).getScale()) {
+                    tightestCommonType = left;
+                } else {
+                    tightestCommonType = right;
+                }
+            } else if (left instanceof DateTimeV2Type) {
+                tightestCommonType = left;
+            } else if (right instanceof DateTimeV2Type) {
+                tightestCommonType = right;
+            } else if (left instanceof DateTimeType || right instanceof 
DateTimeType) {
+                tightestCommonType = DateTimeType.INSTANCE;
+            } else if (left instanceof DateV2Type || right instanceof 
DateV2Type) {
+                tightestCommonType = DateV2Type.INSTANCE;
+            }

Review Comment:
   DateTimeType



-- 
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]

Reply via email to