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


##########
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:
   if compare DateTimeType and DateV2Type, what is the result type?



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to