[
https://issues.apache.org/jira/browse/HIVE-29760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105930#comment-18105930
]
Stamatis Zampetakis commented on HIVE-29760:
--------------------------------------------
In a previous comment, I wrote that after the calcite upgrade to 1.33.0
(HIVE-27102) the NOT BETWEEN disappears completely from the plans. During a
code review [~rubenql] pointed out that the compiler can still generate a NOT
BETWEEN operator via the
[HivePointLookupOptimizerRule|https://github.com/apache/hive/blob/1bcf6d4b8570d84ce6a252b39ffae445d2771991/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java#L253].
An example can be seen in
[udf_between.q.out|https://github.com/apache/hive/blob/1bcf6d4b8570d84ce6a252b39ffae445d2771991/ql/src/test/results/clientpositive/llap/udf_between.q.out#L87]
test case.
> Improve SEARCH expansion to exploit NOT_BETWEEN operator
> --------------------------------------------------------
>
> Key: HIVE-29760
> URL: https://issues.apache.org/jira/browse/HIVE-29760
> Project: Hive
> Issue Type: Task
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Major
> Labels: pull-request-available
>
> Improve SEARCH expansion to exploit NOT_BETWEEN operator.
> Currently a search range like "{{{}(-INF, 10), (20, INF)"{}}} is expanded as:
> {noformat}
> x < 10 OR x > 20
> {noformat}
> But we could simplify the expression by using NOT_BETWEEN (i.e. Hive.BETWEEN
> operator with inverse flag enabled):
> {noformat}
> x NOT BETWEEN 10, 20
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)