[
https://issues.apache.org/jira/browse/CALCITE-4507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17288926#comment-17288926
]
Julian Hyde commented on CALCITE-4507:
--------------------------------------
The description in CALCITE-4446 is a bit imprecise.
But rest assured, we would not rewrite "x = 0 OR x IS NULL" to "x IN (0,
null)". We would rewrite it to "SEARCH(x, SARG(0, NULL AS TRUE))", which has
the desired semantics.
> '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
> 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)