[
https://issues.apache.org/jira/browse/CALCITE-4415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17238324#comment-17238324
]
Julian Hyde commented on CALCITE-4415:
--------------------------------------
Sorry I wasn't clear. I was referring to the new PR,
[#2277|https://github.com/apache/calcite/pull/2279]. Happy to help you get it
working.
I don't think PR 2276 is worth doing. It facilitates 'wrong' behavior, and will
encourage more people to continue the 'wrong' behavior. The longer we leave it,
the more people will complain when we remove NOT_LIKE from Rex land (as there
were when I removed IN and NOT_IN).
> SqlStdOperatorTable.NOT_LIKE has a wrong implementor
> ----------------------------------------------------
>
> Key: CALCITE-4415
> URL: https://issues.apache.org/jira/browse/CALCITE-4415
> Project: Calcite
> Issue Type: Bug
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.27.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{SqlStdOperatorTable.NOT_LIKE}}'s implementor defined in {{RexImpTable}} is
> currently the same as {{LIKE}} (i.e. {{NOT_LIKE}} performs the same operation
> as {{LIKE}}):
> {code}
> ...
> final MethodImplementor likeImplementor =
> new MethodImplementor(BuiltInMethod.LIKE.method, NullPolicy.STRICT,
> false);
> map.put(LIKE, likeImplementor);
> map.put(NOT_LIKE, likeImplementor);
> {code}
> It should be:
> {code}
> ...
> map.put(LIKE, likeImplementor);
> map.put(NOT_LIKE, NotImplementor.of(likeImplementor));
> {code}
> Luckily, SQL queries seem to not suffer the consequences because
> {{StandardConvertletTable}} expands {{x NOT LIKE y}} into {{NOT (x LIKE y)}},
> so the issue is avoided:
> {code}
> // Expand "x NOT LIKE y" into "NOT (x LIKE y)"
> registerOp(SqlStdOperatorTable.NOT_LIKE,
> (cx, call) -> cx.convertExpression(
> SqlStdOperatorTable.NOT.createCall(SqlParserPos.ZERO,
> SqlStdOperatorTable.LIKE.createCall(SqlParserPos.ZERO,
> call.getOperandList()))));
> {code}
> However, creating a plan via RelBuilder using
> {{SqlStdOperatorTable.NOT_LIKE}} will lead to incorrect results.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)