Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dimension filtering with BETWEEN in date-type Dims #370

Conversation

DimitrisStaratzis
Copy link
Contributor

@DimitrisStaratzis DimitrisStaratzis commented Aug 26, 2024

Bug description

This PR fixes the BETWEEN operator when used in Datetime dims.

Query:
select * from nyc where `tpep_pickup_datetime` BETWEEN '2022-01-01T00:00:00' AND '2022-01-02T00:00:00';

More specifically, querying the nyc_taxi 18GB array before the fix was creating these ranges:

[Note] pushed conditions: [1640995200000000000, 4061240611000000000]
It now creates:

[Note] pushed conditions: [1640995200000000000, 1641081600000000000]

Bug fix

The bug was happening because the BETWEEN operator when used with datetimes has 2 arguments which are not constants. This led us to wrongly cast to Item_basic_constant and thus making the ranges nullptrs. I have also checked whether this bug is present to non-datetime dims and it is not.

@DimitrisStaratzis DimitrisStaratzis force-pushed the dstara/sc-53762/mariadb-issue-with-datetime-dimension-filtering branch from 4842a52 to bc6de95 Compare August 27, 2024 11:16
@DimitrisStaratzis DimitrisStaratzis marked this pull request as ready for review August 27, 2024 11:24
@DimitrisStaratzis DimitrisStaratzis merged commit db601bb into master Aug 28, 2024
4 checks passed
@DimitrisStaratzis DimitrisStaratzis deleted the dstara/sc-53762/mariadb-issue-with-datetime-dimension-filtering branch August 28, 2024 13:13
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