xiangfu0 commented on code in PR #20059:
URL: https://github.com/apache/pinot/pull/20059#discussion_r4382476767


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ArrayFunctions.java:
##########
@@ -645,18 +646,26 @@ private static int generatedArrayLength(long start, long 
end, long inc) {
   /// in `float` arithmetic, as the single-stage engine always did.
   private static int generatedArrayLength(float start, float end, float inc) {
     checkFloatingPointArguments(start, end, inc);
-    // TODO: decimal steps such as 0.1 are not exact in binary, so this can 
drop the end; see apache/pinot#19814
-    return checkGeneratedArrayLength((long) ((end - start) / inc + 1) - 1);
+    // Keep float arithmetic for the step count, but use double precision to 
compare its error with the input ULPs.

Review Comment:
   Small doc nit: the method javadoc just above (line 646) still says the step 
count is "computed in `float` arithmetic, as the single-stage engine always 
did," but this now computes `(end - start) / inc` in `double`. Behavior is 
unchanged (I verified the lengths match either way), so it's just the comment 
that's stale — worth updating so the javadoc matches the code.



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