Skip to content

Support arbitrary literal comparisons in BETWEEN operator#2567

Merged
Fokko merged 2 commits into
apache:mainfrom
jtuglu1:support-arbitrary-literal-comparisons-in-between-operator
Oct 5, 2025
Merged

Support arbitrary literal comparisons in BETWEEN operator#2567
Fokko merged 2 commits into
apache:mainfrom
jtuglu1:support-arbitrary-literal-comparisons-in-between-operator

Conversation

@jtuglu1

@jtuglu1 jtuglu1 commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Want to support calling BETWEEN for any valid column types, not just numeric columns. This extends support for filter expressions like date_col BETWEEN '2025-01-01' AND '2025-01-02'.

The test_invalid_between test was removed in favor of letting the type checks happen at evaluation time (when the literals are attempted to be cast to the corresponding column's type for comparison).

Are these changes tested?

Yes, tested locally applying filters to tables.

Are there any user-facing changes?

Yes, BETWEEN operator signature has changed, it nows supports all comparable column types.

@jtuglu1

jtuglu1 commented Oct 4, 2025

Copy link
Copy Markdown
Contributor Author

@Fokko @kevinjqliu any thoughts here?

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice one @jtuglu1 I wasn't aware of this limitation, and I agree that it should be between literals. We'll convert the types when we bind it to the schema 👍

@Fokko Fokko merged commit bc2aa00 into apache:main Oct 5, 2025
10 checks passed
@Fokko

Fokko commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

Also, thanks for the review @maytasm 🙌

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.

3 participants