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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignatureForRound.java:
##########
@@ -35,9 +52,45 @@ default FunctionSignature 
searchSignature(List<FunctionSignature> signatures) {
             if (arguments.size() == 1) {
                 return 
FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE);
             } else if (arguments.size() == 2) {

Review Comment:
   This condition sends every non-negative literal DOUBLE scale to the decimal 
overload, but that overload computes the input decimal as 
`DecimalV3Type.forType(DoubleType.INSTANCE)`, i.e. `DECIMALV3(30,15)`. 
`ComputePrecisionForRound` then clamps the result scale with `Math.min(..., 
decimalV3Type.getScale())`, so a query such as `round(CAST(0.12345678901234567 
AS DOUBLE), 17)` is planned as a decimal result with scale 15 and no longer 
rounds to the requested scale 17. Please either keep the decimal route only for 
scales that the chosen decimal cast can preserve, or compute a decimal 
input/result type whose scale matches the literal scale.



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignatureForRoundTest.java:
##########
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions;
+
+import org.apache.doris.nereids.trees.expressions.Cast;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Ceil;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Floor;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Round;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.RoundBankers;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Truncate;
+import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral;
+import org.apache.doris.nereids.types.DecimalV3Type;
+import org.apache.doris.nereids.types.DoubleType;
+import org.apache.doris.nereids.types.FloatType;
+import org.apache.doris.nereids.types.IntegerType;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SearchSignatureForRoundTest {
+
+    private static final DoubleLiteral DOUBLE_VAL = new 
DoubleLiteral(81.56996587030717);
+
+    private static void assertDecimalReturn(int expectedScale, 
org.apache.doris.nereids.trees.expressions.Expression expr) {

Review Comment:
   FE checkstyle enforces a 120-character maximum line length, and this added 
line is 124 characters, so `mvn validate` will fail. Please wrap the helper 
signature.
   
   ```suggestion
       private static void assertDecimalReturn(int expectedScale,
               org.apache.doris.nereids.trees.expressions.Expression expr) {
   ```



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