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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java:
##########
@@ -376,59 +380,83 @@ public static FunctionSignature 
dynamicComputePropertiesOfArray(
                 ArrayType.of(arrayType.getItemType(), arrayType.containsNull() 
|| containsNull));
     }
 
-    private static FunctionSignature defaultDateTimeV2PrecisionPromotion(
-            FunctionSignature signature, List<Expression> arguments) {
-        DateTimeV2Type finalType = null;
+    // for time type with precision(now are DateTimeV2Type and TimeV2Type),
+    // we will promote the precision of the type to the maximum precision of 
all arguments
+    private static FunctionSignature 
defaultTimePrecisionPromotion(FunctionSignature signature,
+            List<Expression> arguments) {
+        ImmutableList.Builder<DataType> newArgTypesBuilder = 
ImmutableList.builderWithExpectedSize(signature.arity);
+
+        int finalTypeScale = -1;
         for (int i = 0; i < arguments.size(); i++) {
-            DataType targetType;
+            DataType signatureArgType;
             if (i >= signature.argumentsTypes.size()) {
                 Preconditions.checkState(signature.getVarArgType().isPresent(),
                         "argument size larger than signature");
-                targetType = signature.getVarArgType().get();
+                signatureArgType = signature.getVarArgType().get();
             } else {
-                targetType = signature.getArgType(i);
+                signatureArgType = signature.getArgType(i);
             }
-            List<DataType> argTypes = extractArgumentType(DateTimeV2Type.class,
-                    targetType, arguments.get(i).getDataType());
-            if (argTypes.isEmpty()) {
+            List<DataType> nestedTypes = 
extractArgumentTypeBySignature(DateTimeV2Type.class,
+                    signatureArgType, arguments.get(i).getDataType());
+            List<DataType> timeV2Types = 
extractArgumentTypeBySignature(TimeV2Type.class,
+                    signatureArgType, arguments.get(i).getDataType());
+            nestedTypes.addAll(timeV2Types);

Review Comment:
   ```java
   List<DataType> timeLikeTypes = ImmutableList.builder()
      .addAll(extractArgumentTypeBySignature(DateTimeV2Type.class...))
      .addAll(extractArgumentTypeBySignature(TimeV2Type.class...))
      .build();



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/TimeV2Type.java:
##########
@@ -57,6 +64,28 @@ public boolean equals(Object o) {
         return o instanceof TimeV2Type;
     }
 
+    //TODO: implement this method by parsing the string and get the scale of it
+    public static TimeV2Type forTypeFromString(String s) {
+        return MAX;

Review Comment:
   you should implement this function, because the result will different after 
implement it. 
   
   for example
   ```sql
   select time '11:12:13.123456' = time '11:12:13.12' -- should return false
   ```
   
   so you should better implement this function in this pr



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