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 2020/10/29 18:20:00 UTC
[jira] [Commented] (CALCITE-4365) SEARCHes in ANDs and ORs cannot
be simplified if the complexity of its SARG can actually be reduced to 1
[ https://issues.apache.org/jira/browse/CALCITE-4365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223108#comment-17223108 ]
Julian Hyde commented on CALCITE-4365:
--------------------------------------
Can you check my PR for CALCITE-4352 and see whether it fixes it? Like you, I observed that we should keep even simple Sargs as Sargs during simplification, because it allows them to combine with other (perhaps more complex) Sargs.
> SEARCHes in ANDs and ORs cannot be simplified if the complexity of its SARG can actually be reduced to 1
> --------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-4365
> URL: https://issues.apache.org/jira/browse/CALCITE-4365
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Caizhi Weng
> Priority: Major
>
> Consider the following test case in {{RexProgramTest}}.
> {code:java}
> @Test void testSimplifySearch() {
> // (deptno <> 20 OR deptno IS NULL) AND deptno = 10
> // ==>
> // deptno = 10
> final RexNode e =
> and(
> in(vInt(), literal(10), literal(20)),
> eq(vInt(), literal(10)));
> checkSimplify2(e, "=(?0.int0, 10)", "=(?0.int0, 10)");
> }
> {code}
> We expect that {{AND(SEARCH(?0, [10, 20], =(?0, 10)))}} can be simplified to {{=(?0, 10)}} but fails. This is because {{RexSimplify#simplifyAnd}} and {{RexSimplify#simplifyOrs}} does not deal with the case when the complexity of {{SargCollector}} is 1.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)