Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Drill >> mail # dev >> Review Request 14311: Implemented new math functions : log, sqrt, cbrt, rand, round, exp, e, pi, pow


Copy link to this message
-
Review Request 14311: Implemented new math functions : log, sqrt, cbrt, rand, round, exp, e, pi, pow

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14311/
-----------------------------------------------------------

Review request for drill.
Repository: drill-git
Description
-------

New math functions log, sqrt, cbrt, rand, round, exp, e, pi, pow implemented.

Few points:
rand() and random() both are supported currently.
pow() and power() both are supported currently.
Currently log() is supported, this can be changed to ln() if suggested.
Diffs
-----

  common/src/main/java/org/apache/drill/common/expression/fn/MathFunctions.java ee3a099
  exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java 288760b
  exec/ref/src/main/java/org/apache/drill/exec/ref/eval/fn/MathEvaluators.java 347a4f3
  exec/ref/src/test/java/org/apache/drill/exec/ref/RunSimplePlan.java f4992e0
  exec/ref/src/test/resources/new_math.json PRE-CREATION

Diff: https://reviews.apache.org/r/14311/diff/
Testing
-------

Yes.
$ mvn test -Dtest=RunSimplePlan#newMathPlan
{
  "E" : 2.718281828459045,
  "exp" : 2.9048849665247426E13,
  "pow" : 2.8629151E7,
  "PI" : 3.141592653589793,
  "sqrt" : 5.5677643628300215,
  "round" : 32.0,
  "rand" : 0.7015373314736347,
  "cbrt" : 3.141380652391393,
  "log" : 3.4339872044851463,
  "log10" : 1.4913616938342726
}
 {
  "E" : 2.718281828459045,
  "exp" : 2.1464357978591606E14,
  "pow" : 3.9135393E7,
  "PI" : 3.141592653589793,
  "sqrt" : 5.744562646538029,
  "round" : 32.0,
  "rand" : 0.6524812400390043,
  "cbrt" : 3.2075343299958265,
  "log" : 3.4965075614664802,
  "log10" : 1.5185139398778875
}
 {
  "E" : 2.718281828459045,
  "exp" : 5.834617425274549E14,
  "pow" : 4.5435424E7,
  "PI" : 3.141592653589793,
  "sqrt" : 5.830951894845301,
  "round" : 32.0,
  "rand" : 0.2611928590164273,
  "cbrt" : 3.2396118012774835,
  "log" : 3.5263605246161616,
  "log10" : 1.5314789170422551
}
 {
  "E" : 2.718281828459045,
  "exp" : 1.5860134523134308E15,
  "pow" : 5.2521875E7,
  "PI" : 3.141592653589793,
  "sqrt" : 5.916079783099616,
  "round" : 32.0,
  "rand" : 0.09218448010530156,
  "cbrt" : 3.2710663101885897,
  "log" : 3.5553480614894135,
  "log10" : 1.5440680443502757
}
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.441 sec - in org.apache.drill.exec.ref.RunSimplePlan

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.456s
[INFO] Finished at: Tue Sep 24 11:30:42 IST 2013
[INFO] Final Memory: 21M/52M
[INFO] ------------------------------------------------------------------------
Thanks,

Yash Sharma