[
https://issues.apache.org/jira/browse/CALCITE-5336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628571#comment-17628571
]
Julian Hyde commented on CALCITE-5336:
--------------------------------------
I set fixVersion = 1.33 because I think this is almost ready. Comments on the
PR:
* "Add support for IS NOT DISTINCT FROM operator" is not a good commit message
because it does not say where we're adding support.
* I don't like small test classes. There are already tests for
{{RexUtil.predicateConstants}} in {{RexProgramTest}}. Move the test with those.
* Test method don't need {{public}}.
* In javadoc on {{testProjectReduceExpressionsWithIsNotDistinctFrom}}, the word
"should" makes it unclear whether you are documenting the past imperfect state
or the future more perfect state. However, "should" is perfect in a bug
summary, and if you reference the Jira case (as do many other methods in that
test class) it is clear that your method is test case for a bug you just fixed.
* We use {{assertThat}} rather than {{assertEquals}}
* In your test case you could use {{RelBuilder}} for creating {{RexNode}}
expressions. It has methods {{isNotDistinctFrom}}, {{field}} and {{literal}}.
You might need to extend {{literal}} to accept a {{DateString}}. It will
probably make {{relFn}} much more concise.
* Do you really need {{executor}}?
> Support inferring constants from predicates with IS NOT DISTINCT FROM operator
> ------------------------------------------------------------------------------
>
> Key: CALCITE-5336
> URL: https://issues.apache.org/jira/browse/CALCITE-5336
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Jasmin Trada
> Assignee: Jasmin Trada
> Priority: Trivial
> Labels: pull-request-available
> Fix For: 1.33.0
>
> Original Estimate: 168h
> Time Spent: 10m
> Remaining Estimate: 167h 50m
>
> Whenever we have {{IS NOT DISTINCT FROM}} operator in a predicate, the
> {{predicateConstants}} method in {{RexUtil}} is not able to identify the
> constants.
> E.g., If we make a predicate as given below,
> {code}
> //dec20 = IS_NOT_DISTINCT_FROM($0, CAST(2020-12-11):DATE)
> RexNode dec20 = rexB.makeCall(IS_NOT_DISTINCT_FROM,
> rexB.makeInputRef(dateColumnType, 0),
> rexB.makeLiteral(new DateString(2020, 12, 11), dateColumnType,
> false));
> {code}
> and if we call {{RexUtil.predicateConstants(RexNode.class, rexB,
> Arrays.asList(dec20))}},
> it will return an empty map, but it should have returned something like this:
> {code}
> { "$0" -> "CAST(2020-12-11):DATE"}
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)