Skip to content

HIVE-29760: Improve SEARCH expansion to exploit NOT_BETWEEN operator#6634

Open
rubenada wants to merge 2 commits into
apache:masterfrom
rubenada:HIVE-29760
Open

HIVE-29760: Improve SEARCH expansion to exploit NOT_BETWEEN operator#6634
rubenada wants to merge 2 commits into
apache:masterfrom
rubenada:HIVE-29760

Conversation

@rubenada

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Improve SEARCH expansion to exploit NOT_BETWEEN operator

Why are the changes needed?

Generate a simpler expression in search expansion using NOT_BETWEEN, e.g. x NOT BETWEEN 10, 20 vs the current x < 10 OR x > 20

Does this PR introduce any user-facing change?

No

How was this patch tested?

New unit tests added

@sonarqubecloud

Copy link
Copy Markdown

INNER JOIN (SELECT `key`, `value`
FROM `default`.`src1`
WHERE (`key` < 20 OR `key` > 100) AND `key` IS NOT NULL) AS `t6` ON `t4`.`key` = `t6`.`key`
WHERE CAST(`key` AS DOUBLE) BETWEEN 20 AND 100 AND `key` IS NOT NULL) AS `t6` ON `t4`.`key` = `t6`.`key`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unparse issue (operator unparses as "BETWEEN" instead of "NOT BETWEEN") will be handled in a separate follow-up ticket: https://issues.apache.org/jira/browse/HIVE-29765
On the plan itself the operator is correctly represented as a "NOT BETWEEN" though, so no issue there (see below)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants