gianm commented on code in PR #14654:
URL: https://github.com/apache/druid/pull/14654#discussion_r1274014813


##########
processing/src/main/java/org/apache/druid/math/expr/ExprEval.java:
##########
@@ -644,6 +644,27 @@ public static Number computeNumber(@Nullable String value)
     return rv;
   }
 
+  /**
+   * Returns true if an {@link ExprEval} which has been cast to some other 
type is not equal to the original type.
+   * Effectively, this only happens with casts to {@link ExpressionType#LONG} 
and {@link ExpressionType#LONG_ARRAY}.

Review Comment:
   Surely casts of string to number also can lose equality?
   
   Cast of long to double can, also, because not all longs are representable as 
doubles. For example `Long.MAX_VALUE - 1` does not round-trip to `double` and 
back to `long` as the same number. Does this matter here?
   
   If the scope of the method is meant to be narrower (only applying to 
cast-to-long), I suggest updating its javadocs & possibly its name accordingly.
   
   I personally don't find the names `eval` and `evalCast` self-explanatory, so 
please add `@param` annotations.



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