mghildiy commented on code in PR #15377:
URL: https://github.com/apache/pinot/pull/15377#discussion_r2051635795


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/RoundDecimalTransformFunction.java:
##########
@@ -90,18 +90,33 @@ public double[] transformToDoubleValuesSV(ValueBlock 
valueBlock) {
     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();
+        if (leftValues[i] == Double.NEGATIVE_INFINITY || leftValues[i] == 
Double.POSITIVE_INFINITY ||
+                leftValues[i] == Double.NaN) {

Review Comment:
   Or we can check with Double.isNaN. It's documentation says:
   'This method corresponds to the isNaN operation defined in IEEE 754.'
   
   So if its NaN, what value we return? From postgres 
[documentation](https://www.postgresql.org/docs/8.1/datatype.html#:~:text=In%20addition%20to%20ordinary%20numeric,on%20NaN%20yields%20another%20NaN.):
   
   > In addition to ordinary numeric values, the numeric type allows the 
special value NaN, meaning "not-a-number". Any operation on NaN yields another 
NaN.



-- 
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...@pinot.apache.org

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


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

Reply via email to