> On May 16, 2014, 9:47 a.m., Mehant Baid wrote: > > exec/java-exec/src/main/codegen/data/MathFunc.tdd, line 25 > > <https://reviews.apache.org/r/20482/diff/2/?file=577332#file577332line25> > > > > 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.
Removed Random! > On May 16, 2014, 9:47 a.m., Mehant Baid wrote: > > exec/java-exec/src/main/codegen/data/MathFunc.tdd, line 26 > > <https://reviews.apache.org/r/20482/diff/2/?file=577332#file577332line26> > > > > Since there is only one implementation of 'pi' it doesn't need to > > generated using freemarker you can add it directly to MathFunctions.java > > Moved PI to MathFunctions.java > On May 16, 2014, 9:47 a.m., Mehant Baid wrote: > > exec/java-exec/src/main/codegen/data/MathFunc.tdd, line 165 > > <https://reviews.apache.org/r/20482/diff/2/?file=577332#file577332line165> > > > > 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. Added code for the same. Is this what we meant or something else needs to be taken care of? - Yash ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/20482/#review43201 ----------------------------------------------------------- On May 18, 2014, 7:51 a.m., Yash Sharma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/20482/ > ----------------------------------------------------------- > > (Updated May 18, 2014, 7:51 a.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. > > 'Random' function removed. > > > 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/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java > 7d5a3a6 > > 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 > >
