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

Steven Phillips commented on DRILL-3912:
----------------------------------------

It looks like your patch does a subset of my patch. It will eliminate common 
vector read expressions in the same JBlock.

My patch will eliminate any redundant expression as long as the previously 
evaluated expression is in scope. For example, with filter:

( a + b  > 0 and ( a + b = c or a + b = d))

the expression (a + b) would currently have to be computed 3 times, and each 
reference to a and b would require accessing the corresponding vectors.

With my patch, (a + b) would only be calculated once.

> Common subexpression elimination in code generation
> ---------------------------------------------------
>
>                 Key: DRILL-3912
>                 URL: https://issues.apache.org/jira/browse/DRILL-3912
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Steven Phillips
>            Assignee: Jinfeng Ni
>
> Drill currently will evaluate the full expression tree, even if there are 
> redundant subtrees. Many of these redundant evaluations can be eliminated by 
> reusing the results from previously evaluated expression trees.
> For example,
> {code}
> select a + 1, (a + 1)* (a - 1) from t
> {code}
> Will compute the entire (a + 1) expression twice. With CSE, it will only be 
> evaluated once.
> The benefit will be reducing the work done when evaluating expressions, as 
> well as reducing the amount of code that is generated, which could also lead 
> to better JIT optimization.



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

Reply via email to