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

Jinfeng Ni commented on DRILL-3912:
-----------------------------------

I have not tried your patch.

Could  you pls check two cases:
1)  is t2.department_id using only one holder and one vector access in the 
generated code?  
{code}
select t1.full_name from cp.`employee.json` t1, cp.`department.json` t2 
where t1.department_id = t2.department_id and t1.position_id = 
t2.department_id");
{code}

Last time I tried with my patch,  after the HashJoin run-time code remove the 
redundant holder, it hit scalar replacement error. I'm curious why your patch 
did not hit SR error, if the redundant holder is removed.

2) common expression in project's multiple expressions:

select  a+1, a + 1 +2, a + 1 + 3

Also, are you targeting this patch for 1.2 or next release? 


> 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