You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Mehant Baid <ba...@gmail.com> on 2014/02/08 08:03:32 UTC
Re: Review Request 16230: DRILL-320: Rework math functions to use codegen.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16230/
-----------------------------------------------------------
(Updated Feb. 8, 2014, 7:03 a.m.)
Review request for drill and Jacques Nadeau.
Changes
-------
Revised patch so it applies cleanly on top of Master.
Bugs: DRILL-320
https://issues.apache.org/jira/browse/DRILL-320
Repository: drill-git
Description
-------
Rework the implementations of existing math functions to use codegen so that we have a more complete list of implementations. Previous implementations were done manually so we only had a handful of implementations for each function. Now that we are using freemarker to generate code during compile time we can easily have all the required implementations.
We were also missing any implementation for multiply and divide functions, so added that as part of this JIRA.
The implementations added here are for inputs with similar types (eg: for the function 'add', the inputs can be of type INT, INT or FLOAT, FLOAT etc). The expectation is that if we have implementations for similar types of input, once we have implicit casting we should be able to cast one of the inputs so that both the inputs are of the same type.
MathFunctionTypes.tdd, MathFunctionTemplates.java:
The above two files are used by freemarker to generate code for all the types specified in MathFunctionTypes.tdd using the template specified in MathFunctionTemplates.java.
ComparisonFunctions.java, SimpleRepeatedFunctions.java:
Simple modification in these files to use the correct class for logging purposes.
MathFunctions.java:
This class used to contain some implementations for add, subtract methods. Removed those from here, since we have all the implementations via codegen.
TestMathFunctions.java, simple_math_functions.json:
Added really basic test cases for add and multiply functions.
Diffs (updated)
-----
exec/java-exec/src/main/codegen/config.fmpp cd2b2cc
exec/java-exec/src/main/codegen/data/MathFunctionTypes.tdd PRE-CREATION
exec/java-exec/src/main/codegen/templates/MathFunctionTemplates.java PRE-CREATION
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java ea251c3
exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java PRE-CREATION
exec/java-exec/src/test/resources/functions/simple_math_functions.json PRE-CREATION
Diff: https://reviews.apache.org/r/16230/diff/
Testing
-------
Manual testing using sqlline.
Added basic test cases in TestMathFunctions.java, simple addition and multiplication of constants.
Thanks,
Mehant Baid
Re: Review Request 16230: DRILL-320: Rework math functions to use codegen.
Posted by Jason Altekruse <al...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16230/#review34016
-----------------------------------------------------------
exec/java-exec/src/main/codegen/data/MathFunctionTypes.tdd
<https://reviews.apache.org/r/16230/#comment63948>
These inner lists are currently all identical (it looks that way, but I actually had to use diff to make sure), is there any chance we would want to declare future binary functions with different casting rules? Would it make sense to declare this list once outside of all of the json objects for the function descriptions? If we need to have a mapping between functions and these longish lists of casting rules we could include a list of function names to apply them to, but for now it does not seem like that is needed.
- Jason Altekruse
On Feb. 8, 2014, 7:03 a.m., Mehant Baid wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16230/
> -----------------------------------------------------------
>
> (Updated Feb. 8, 2014, 7:03 a.m.)
>
>
> Review request for drill and Jacques Nadeau.
>
>
> Bugs: DRILL-320
> https://issues.apache.org/jira/browse/DRILL-320
>
>
> Repository: drill-git
>
>
> Description
> -------
>
> Rework the implementations of existing math functions to use codegen so that we have a more complete list of implementations. Previous implementations were done manually so we only had a handful of implementations for each function. Now that we are using freemarker to generate code during compile time we can easily have all the required implementations.
>
> We were also missing any implementation for multiply and divide functions, so added that as part of this JIRA.
>
> The implementations added here are for inputs with similar types (eg: for the function 'add', the inputs can be of type INT, INT or FLOAT, FLOAT etc). The expectation is that if we have implementations for similar types of input, once we have implicit casting we should be able to cast one of the inputs so that both the inputs are of the same type.
>
>
> MathFunctionTypes.tdd, MathFunctionTemplates.java:
> The above two files are used by freemarker to generate code for all the types specified in MathFunctionTypes.tdd using the template specified in MathFunctionTemplates.java.
>
> ComparisonFunctions.java, SimpleRepeatedFunctions.java:
> Simple modification in these files to use the correct class for logging purposes.
>
> MathFunctions.java:
> This class used to contain some implementations for add, subtract methods. Removed those from here, since we have all the implementations via codegen.
>
> TestMathFunctions.java, simple_math_functions.json:
> Added really basic test cases for add and multiply functions.
>
>
> Diffs
> -----
>
> exec/java-exec/src/main/codegen/config.fmpp cd2b2cc
> exec/java-exec/src/main/codegen/data/MathFunctionTypes.tdd PRE-CREATION
> exec/java-exec/src/main/codegen/templates/MathFunctionTemplates.java PRE-CREATION
> exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java ea251c3
> exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMathFunctions.java PRE-CREATION
> exec/java-exec/src/test/resources/functions/simple_math_functions.json PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16230/diff/
>
>
> Testing
> -------
>
> Manual testing using sqlline.
>
> Added basic test cases in TestMathFunctions.java, simple addition and multiplication of constants.
>
>
> Thanks,
>
> Mehant Baid
>
>