----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/20482/#review43201 -----------------------------------------------------------
exec/java-exec/src/main/codegen/data/MathFunc.tdd <https://reviews.apache.org/r/20482/#comment77285> We already have random() function in class: org.apache.drill.exec.expr.fn.impl.MathFunctions.java We use freemarker template to generate code if the same code is repeated for various types, in this case since there is only a single implementation the function implementation is written directly. exec/java-exec/src/main/codegen/data/MathFunc.tdd <https://reviews.apache.org/r/20482/#comment77286> Since there is only one implementation of 'pi' it doesn't need to generated using freemarker you can add it directly to MathFunctions.java exec/java-exec/src/main/codegen/data/MathFunc.tdd <https://reviews.apache.org/r/20482/#comment77287> Can you add these functions for the decimal data type as well. For now you can convert the decimal into BigDecimal and use BigDecimal functions to perform the math. Let me know if you have any questions about it. - Mehant Baid On May 9, 2014, 1:05 p.m., Yash Sharma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/20482/ > ----------------------------------------------------------- > > (Updated May 9, 2014, 1:05 p.m.) > > > Review request for drill, Aditya Kishore, Jacques Nadeau, Jinfeng Ni, and > Mehant Baid. > > > Repository: drill-git > > > Description > ------- > > Added the new codegen implementation for Math Functions: rand, cbrt, exp, > log(a), log(a,base), pi, degrees, radians on latest master. > > These can only be tested by directly submitting the Physical Plan since Optiq > currently does not consider these. > > > Diffs > ----- > > exec/java-exec/src/main/codegen/data/MathFunc.tdd 228d207 > exec/java-exec/src/main/codegen/templates/MathFunctions.java ac7cedb > > exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java > 3a67d31 > exec/java-exec/src/test/resources/functions/testExtendedMathFunctions.json > PRE-CREATION > > Diff: https://reviews.apache.org/r/20482/diff/ > > > Testing > ------- > > Yes. > > $mvn test -Dtest=TestNewMathFunctions#testExtendedMathFunc > > ----------------------------------------------- > ACTUAL_RESULTS EXPECTED_RESULTS > ----------------------------------------------- > 10.0 10.0 > 2.302585092994046 2.302585092994046 > 6.0 6.0 > 22026.465794806718 22026.465794806718 > 28.64788975654116 28.64788975654116 > 0.7853981633974483 0.7853981633974483 > 3.141592653589793 3.141592653589793 > ----------------------------------------------- > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.142 sec - > in org.apache.drill.exec.fn.impl.TestNewMathFunctions > > Results : > > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 > > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 52.755 s > [INFO] Finished at: 2014-05-09T18:30:16+05:30 > [INFO] Final Memory: 48M/711M > [INFO] > ------------------------------------------------------------------------ > > > Thanks, > > Yash Sharma > >
