This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new d3c322dcc56 roundDecimal() fails for null FLOAT values (#15377)
d3c322dcc56 is described below

commit d3c322dcc565148a8886313b0bdc4285183c1de2
Author: Manish <[email protected]>
AuthorDate: Sat Aug 23 02:46:44 2025 +0530

    roundDecimal() fails for null FLOAT values (#15377)
---
 .../function/RoundDecimalTransformFunction.java    | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/RoundDecimalTransformFunction.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/RoundDecimalTransformFunction.java
index 1fbfcecaf3a..55bc42d5ba0 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/RoundDecimalTransformFunction.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/RoundDecimalTransformFunction.java
@@ -90,18 +90,32 @@ public class RoundDecimalTransformFunction extends 
BaseTransformFunction {
     double[] leftValues = 
_leftTransformFunction.transformToDoubleValuesSV(valueBlock);
     if (_fixedScale) {
       for (int i = 0; i < length; i++) {
-        _doubleValuesSV[i] = BigDecimal.valueOf(leftValues[i])
-            .setScale(_scale, RoundingMode.HALF_UP).doubleValue();
+        double value = leftValues[i];
+        try {
+          _doubleValuesSV[i] = BigDecimal.valueOf(value).setScale(_scale, 
RoundingMode.HALF_UP).doubleValue();
+        } catch (Exception e) {
+          _doubleValuesSV[i] = value;
+        }
       }
     } else if (_rightTransformFunction != null) {
       int[] rightValues = 
_rightTransformFunction.transformToIntValuesSV(valueBlock);
       for (int i = 0; i < length; i++) {
-        _doubleValuesSV[i] = BigDecimal.valueOf(leftValues[i])
-            .setScale(rightValues[i], RoundingMode.HALF_UP).doubleValue();
+        double value = leftValues[i];
+        int scale = rightValues[i];
+        try {
+          _doubleValuesSV[i] = BigDecimal.valueOf(value).setScale(scale, 
RoundingMode.HALF_UP).doubleValue();
+        } catch (Exception e) {
+          _doubleValuesSV[i] = value;
+        }
       }
     } else {
       for (int i = 0; i < length; i++) {
-        _doubleValuesSV[i] = (double) Math.round(leftValues[i]);
+        double value = leftValues[i];
+        if (value == Double.NEGATIVE_INFINITY || value == 
Double.POSITIVE_INFINITY || Double.isNaN(value)) {
+          _doubleValuesSV[i] = value;
+        } else {
+          _doubleValuesSV[i] = Math.round(value);
+        }
       }
     }
     return _doubleValuesSV;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to