Review Board 1.7.22


Implemented new math functions : log, sqrt, cbrt, rand, round, exp, e, pi, pow

Review Request #14311 - Created Sept. 24, 2013 and updated

Yash Sharma
Reviewers
drill-git
drill-git
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.
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] ------------------------------------------------------------------------