[
https://issues.apache.org/jira/browse/CALCITE-4507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Danny Chen updated CALCITE-4507:
--------------------------------
Description:
SQL statements:
{code:sql}
a = 0 or a is null -- returns true when a is null
a in (0, null) -- returns null when a is null
{code}
have different semantics when {{a}} is null, we should not represent it as a
sarg after {{RexSimplify}},
check this test in {{RexProgramTest}}:
{code:java}
@Test void testSimplifyInOr() {
or(
gt(vInt(), literal(0)),
isNull(vInt())),
">(?0.int0, 0)");
}
{code}
> 'a = 0 or a is null' should not be rewrite to a sarg 'a in (0, null)'
> ---------------------------------------------------------------------
>
> Key: CALCITE-4507
> URL: https://issues.apache.org/jira/browse/CALCITE-4507
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0, 1.27.0
> Reporter: Danny Chen
> Priority: Major
>
> SQL statements:
> {code:sql}
> a = 0 or a is null -- returns true when a is null
> a in (0, null) -- returns null when a is null
> {code}
> have different semantics when {{a}} is null, we should not represent it as a
> sarg after {{RexSimplify}},
> check this test in {{RexProgramTest}}:
> {code:java}
> @Test void testSimplifyInOr() {
> or(
> gt(vInt(), literal(0)),
> isNull(vInt())),
> ">(?0.int0, 0)");
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)