[
https://issues.apache.org/jira/browse/CALCITE-6953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17944384#comment-17944384
]
xiong duan commented on CALCITE-6953:
-------------------------------------
How about this SQL?
{code:java}
select * from emp where deptno = 10
union all
select * from emp where 1=0{code}
can be optimized to:
{code:java}
select * from emp where deptno = 10{code}
and
{code:java}
select * from emp where deptno = 10
union
select * from emp where 1=0{code}
can be optimized to :
{code:java}
select distinct * from emp where deptno = 10 {code}
Perhaps this can be treated as a new issue.
I would like to see if there is a SQL test case for this issue.
> Extend UnionEliminatorRule to support Intersect and Minus
> ---------------------------------------------------------
>
> Key: CALCITE-6953
> URL: https://issues.apache.org/jira/browse/CALCITE-6953
> Project: Calcite
> Issue Type: Improvement
> Affects Versions: 1.39.0
> Reporter: Zhen Chen
> Assignee: Zhen Chen
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> We can eliminate Intersect and Minus when `all` is true and there is only one
> input.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)