[ 
https://issues.apache.org/jira/browse/DRILL-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14340875#comment-14340875
 ] 

Jason Altekruse commented on DRILL-2060:
----------------------------------------

As I was testing this new feature, I was not able to define tests in the exec 
module due to my use of the expression interpreter. The issue is that we have 
compile-time code generation in exec to fill out function definitions for all 
of the types. Currently, a separate interpreter module finds all of these 
generated classes (as well as the functions defined manually without 
generation) and generates modified functions suitable for the interpreted 
expression visitor. These interpreter versions of the functions were only 
available after the interpreter module was run. As we wanted to start using the 
interpreted expression evaluation in planning, it needed to be available to the 
unit tests in the exec module. This could have been accomplished by separating 
the code generation from exec, running interpreter and then running exec, but 
this was a fair amount of build modification work for little benefit.

Instead, I have rewritten the interpreted expression visitor to use the regular 
drill function classes, and tie together their inputs and outputs using 
reflection, rather than the generated classes that could have their inputs 
passed directly. This has the advantages of solving the build issue without a 
new module (it actually removes the interpreter module entirely) as well as 
reducing the number of classes we have to ship with Drill.

I am separating these changes from the core ones for review, but I am going to 
leave them both with this JIRA. Currently there is no part of Drill actively 
using the interpreter, just a few unit tests. I want to make sure that the 
refactoring goes in along with the constant folding rule that will ensure it is 
thoroughly tested in execution.

> Support constant folding in expressions in Filter
> -------------------------------------------------
>
>                 Key: DRILL-2060
>                 URL: https://issues.apache.org/jira/browse/DRILL-2060
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Execution - Flow, Query Planning & Optimization
>            Reporter: Aditya Kishore
>            Assignee: Jacques Nadeau
>             Fix For: 0.8.0
>
>         Attachments: DRILL-2060-const-folding-feb-6.diff, DRILL-2060.patch
>
>
> If one side of a filter condition is a constant expression, we should be able 
> to evaluate the expression in the planning phase and replace the expression 
> with the constant value.
> For example, the following filter
> {{Where shipdate < date '1997-01-01' + interval '1' year}}
> can be re-written as
> {{Where shipdate < date '1998-01-01'}}
> Or 
> {{Where age + 5 < 42}}
> can be re-written as
> {{Where age < 37}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to