Skip to content

[AMORO-4220] [Improvement] Support BETWEEN and reversed comparison SQL filters in ExpressionUtil.#4221

Open
slfan1989 wants to merge 1 commit into
apache:masterfrom
slfan1989:amoro-4220
Open

[AMORO-4220] [Improvement] Support BETWEEN and reversed comparison SQL filters in ExpressionUtil.#4221
slfan1989 wants to merge 1 commit into
apache:masterfrom
slfan1989:amoro-4220

Conversation

@slfan1989
Copy link
Copy Markdown
Contributor

@slfan1989 slfan1989 commented May 17, 2026

Why are the changes needed?

Close #4220.

ExpressionUtil.convertSqlFilterToIcebergExpression() currently supports basic SQL filters only when the table column is on the left side of a comparison, such as column_a > 1.

However, some valid SQL filter forms are not supported yet:

  • column_a BETWEEN 1 AND 10
  • column_a NOT BETWEEN 1 AND 10
  • 1 < column_a
  • 1 <= column_a

These expressions are common in SQL predicates. Supporting them makes SQL filter conversion more complete and improves compatibility with user-provided filter conditions.

Brief change log

  • Added support for BETWEEN and NOT BETWEEN in ExpressionUtil.
  • Added support for comparison expressions where the column appears on the right side.
  • Added a comparison operator helper to normalize reversed comparisons, for example:
    • 1 < column_a -> column_a > 1
    • 1 >= column_a -> column_a <= 1
  • Added unit tests in TestExpressionUtil for:
    • BETWEEN
    • NOT BETWEEN
    • reversed >, >=, <, <=, =, and != comparisons

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? not documented

@slfan1989 slfan1989 changed the title [AMORO-4420] [Improvement] Support BETWEEN and reversed comparison SQL filters in ExpressionUtil. [AMORO-4220] [Improvement] Support BETWEEN and reversed comparison SQL filters in ExpressionUtil. May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Support BETWEEN and reversed comparison SQL filters in ExpressionUtil

1 participant