You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Caizhi Weng (Jira)" <ji...@apache.org> on 2020/10/29 11:57:00 UTC
[jira] [Created] (CALCITE-4365) SEARCHes in ANDs and ORs cannot be
simplified if the complexity of its SARG can actually be reduced to 1
Caizhi Weng created CALCITE-4365:
------------------------------------
Summary: 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
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)