github-actions[bot] commented on code in PR #61328:
URL: https://github.com/apache/doris/pull/61328#discussion_r2946011318


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java:
##########
@@ -748,12 +748,32 @@ public static Expression makeTime(BigIntLiteral hour, 
BigIntLiteral minute, Doub
             secondValue = 59;
         }
 
-        double totalSeconds = Math.abs(hourValue) * 3600 + minuteValue * 60
-                + Math.round(secondValue * 1000000.0) / 1000000.0;
-        if (hourValue < 0) {
-            totalSeconds = -totalSeconds;
+        return new TimeV2Literal((int) Math.abs(hourValue), (int) minuteValue, 
(int) secondValue,
+                            (int) Math.round(secondValue * 1000000) % 1000000, 
6, hourValue < 0);
+    }
+
+    /**
+     * time transformation function: maketime
+     */
+    @ExecFunction(name = "maketime")
+    public static Expression makeTime(BigIntLiteral hour, BigIntLiteral 
minute, BigIntLiteral second) {
+        long hourValue = hour.getValue();
+        long minuteValue = minute.getValue();
+        long secondValue = second.getValue();
+
+        if (minuteValue < 0 || minuteValue >= 60 || secondValue < 0 || 
secondValue >= 60) {
+            return new NullLiteral(TimeV2Type.SYSTEM_DEFAULT);
         }
-        return new TimeV2Literal(totalSeconds);
+        if (Math.abs(hourValue) > 838) {
+            hourValue = hourValue > 0 ? 838 : -838;
+            minuteValue = 59;
+            secondValue = 59;
+        } else if (Math.abs(hourValue) == 838 && secondValue > 59) {

Review Comment:
   **Dead code**: This `else if` branch is unreachable in the `BigIntLiteral` 
overload. Since `secondValue` is a `long` and the validation above 
(`secondValue >= 60`) already returns null, `secondValue` must be in range `[0, 
59]` (integers). Therefore `secondValue > 59` is always false here.
   
   This branch makes sense in the `DoubleLiteral` overload above (where 
`secondValue` can be e.g. 59.5 which is `< 60` but `> 59`), but for the integer 
version it should be removed to avoid confusion.
   
   Suggested fix: Remove the `else if` block in this integer overload, or add a 
comment explaining it's kept for symmetry with the Double overload.



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