You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2024/10/29 17:55:00 UTC
[jira] [Comment Edited] (CALCITE-6650) Optimize the IN sub-query and SOME sub-query by Metadata RowCount
[ https://issues.apache.org/jira/browse/CALCITE-6650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17893938#comment-17893938 ]
Julian Hyde edited comment on CALCITE-6650 at 10/29/24 5:54 PM:
----------------------------------------------------------------
Can you modify the description, adding your reasoning? Does 'having false' result in the subquery returning 0 rows? (That's very subtle.) I see 'not in' and I start worrying about nulls.
I looked at the PR, was surprised to see so many tests added to RelOptRulesTest. It's not clear from the summary that this is a planner rule bug. Each test should explain the deduction that is supposed to be happening.
was (Author: julianhyde):
Can you modify the description, adding your reasoning? Does 'having false' result in the subquery returning 0 rows? (That's very subtle.) I see 'not in' and I start worrying about nulls.
> Optimize the IN sub-query and SOME sub-query by Metadata RowCount
> -----------------------------------------------------------------
>
> Key: CALCITE-6650
> URL: https://issues.apache.org/jira/browse/CALCITE-6650
> Project: Calcite
> Issue Type: Improvement
> Reporter: xiong duan
> Priority: Major
> Labels: pull-request-available
>
> SQL:
> {code:java}
> select * from dept as d where deptno not in (select count(*) from emp e having false)
> Before this PR:
> LogicalProject(DEPTNO=[$0], NAME=[$1])
> LogicalProject(DEPTNO=[$0], NAME=[$1])
> LogicalFilter(condition=[OR(=($2, 0), AND(IS NULL($5), >=($3, $2)))])
> LogicalJoin(condition=[=(CAST($0):BIGINT NOT NULL, $4)], joinType=[left])
> LogicalJoin(condition=[true], joinType=[inner])\n
> LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> LogicalProject(c=[$0], ck=[$0])
> LogicalAggregate(group=[{}], c=[COUNT()])
> LogicalValues(tuples=[[]])
> LogicalProject(EXPR$0=[$0], i=[true])
> LogicalValues(tuples=[[]])\n
> After this PR:
> LogicalProject(DEPTNO=[$0], NAME=[$1])
> LogicalTableScan(table=[[CATALOG, SALES, DEPT]]) {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)