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

Julian Hyde commented on CALCITE-1920:
--------------------------------------

It might be worth writing a test case to make sure that you get the behavior 
you want in, say, RelOptRulesTest. I can see that converting

{code}SELECT * FROM t1 JOIN (SELECT DISTINCT k FROM t2) USING (k){code}

to

{code}SELECT * FROM t1 JOIN (SELECT DISTINCT k FROM t2 WHERE k IS NOT NULL) 
USING (k){code}

might improve the query significantly.

> Add IS_NOT_NULL predicate on not-nullable equi-join keys
> --------------------------------------------------------
>
>                 Key: CALCITE-1920
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1920
>             Project: Calcite
>          Issue Type: Improvement
>    Affects Versions: 1.13.0
>            Reporter: Ted Xu
>            Assignee: Julian Hyde
>
> In equi-joins, if the join keys are not-nullable according to join type, we 
> can assign a IS_NOT_NULL predicate to reduce input. For example, query:
> {code:sql}
> select * from src1 join src2 on src1.id = src2.id
> {code}
> can be rewrite to 
> {code:sql}
> select * from 
> (select * from src1 where src1.id is not null) src1
> join 
> (select * from src2 where src2.id is not null) src2
> on src1.id = src2.id
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to