richardstartin commented on a change in pull request #8304:
URL: https://github.com/apache/pinot/pull/8304#discussion_r830181728



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/SingleParamMathTransformFunction.java
##########
@@ -161,4 +161,55 @@ protected void applyMathOperator(double[] values, int 
length) {
       }
     }
   }
+
+  public static class Log2TransformFunction extends 
SingleParamMathTransformFunction {
+    public static final String FUNCTION_NAME = "log2";
+
+    @Override
+    public String getName() {
+      return FUNCTION_NAME;
+    }
+
+    @Override
+    protected void applyMathOperator(double[] values, int length) {
+      for (int i = 0; i < length; i++) {
+        _results[i] = Math.log(values[i]) / Math.log(2);

Review comment:
       suggest factoring `Math.log(2)` into a `private static final` constant. 
Not sure if this will fold otherwise.




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