You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/03/04 02:11:05 UTC

[GitHub] [incubator-druid] gianm commented on a change in pull request #7182: support sin cos etc trigonometric function in sql

gianm commented on a change in pull request #7182: support sin cos etc trigonometric function in sql
URL: https://github.com/apache/incubator-druid/pull/7182#discussion_r261904794
 
 

 ##########
 File path: core/src/main/java/org/apache/druid/math/expr/Function.java
 ##########
 @@ -122,6 +122,26 @@ protected ExprEval eval(double x, double y)
     }
   }
 
+  class Pi implements Function
+  {
+    @Override
+    public String name()
+    {
+      return "pi";
+    }
+
+    @Override
+    public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings)
+    {
+      if (args.size() >= 1) {
+        throw new IAE("Function[%s] needs 0 argument", name());
+      }
+
+      return ExprEval.of(Math.PI);
 
 Review comment:
   Could be extracted to a `private static final` constant.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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