You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/04/19 13:30:54 UTC

[GitHub] [pinot] richardstartin commented on a diff in pull request #8563: Add common comparison scalar functions for filterConfig during ingestion (WIP)

richardstartin commented on code in PR #8563:
URL: https://github.com/apache/pinot/pull/8563#discussion_r853080608


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ArithmeticFunctions.java:
##########
@@ -153,4 +152,19 @@ public static double truncate(double a, int scale) {
   public static double truncate(double a) {
     return Math.signum(a) * Math.floor(Math.abs(a));
   }
+
+  @ScalarFunction(names = {"gte"})
+  public static boolean greaterThanOrEquals(double a, double b) {
+    return a >= b;
+  }
+
+  @ScalarFunction(names = {"lte"})
+  public static boolean lessThanOrEquals(double a, double b) {
+    return a <= b;
+  }
+
+  @ScalarFunction
+  public static boolean equals(double a, double b) {
+    return a == b;

Review Comment:
   this isn't a robust way to compare `double` values for equality, I suggest using an epsilon of 1e-7



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

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


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