[ 
https://issues.apache.org/jira/browse/HIVE-29760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18098818#comment-18098818
 ] 

Stamatis Zampetakis commented on HIVE-29760:
--------------------------------------------

The {{NOT BETWEEN}} is a Hive specific operator while {{NOT EQUALS}} is a 
standard operator. The {{NOT BETWEEN}} cannot be handled by the RexSimplify, 
and potentially other places e.g., metadata handlers.

During the upgrade to 1.33.0 (HIVE-27102) the transformation of NOT BETWEEN to 
primitive operators was considered beneficial. Citing the doc on the respective 
ticket:
{quote}With this change NOT BETWEEN disappears completely from the plans. The 
new version is equally efficient and easier to handle since it relies on 
primitive operators that are handled better in Calcite and Hive. Since NOT 
BETWEEN disappears more code could be potentially dropped but it is outside the 
scope of this commit and upgrade.
{quote}
At this stage, there are pros & cons for both directions so cannot make up my 
mind on what is preferred.

> 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)

Reply via email to