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

Support casting expressions in pruning logic #3377

Closed
alamb opened this issue Sep 6, 2022 · 1 comment · Fixed by #3422
Closed

Support casting expressions in pruning logic #3377

alamb opened this issue Sep 6, 2022 · 1 comment · Fixed by #3422
Labels
enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented Sep 6, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Sometimes predicates include casts. Some of these casts are optimized away during query planning, but some can not be.

A practical example of such a cast might be this query to look for data 4 days in the past

cast (now() as bigint) - cast(time as bigint) < 3600 *4 *1000000000

While this particular query will likely be cleaned up into nicer things like (now() - time) < interval '4 days' as we fill out the time / date functionality, the pattern will still persist if we have things like

cast(int_col) as Decimal(19,5) < 123.45

Thus, it is important to support the cast during the evaluation of the pruning predicate

Describe the solution you'd like

I would like the expression prunning logic(PruningPredicate) to handle expressions such as

cast(time as bigint) < 3600

Note that since the pruning logic is based on comparing min/max values, we must be careful that any casts we apply preserve order. For example, casts from numbers <--> string are likely not correct

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

@alamb alamb added the enhancement New feature or request label Sep 6, 2022
@alamb
Copy link
Contributor Author

alamb commented Sep 8, 2022

This may be more important as we move more casting to the logical plan (e.g. #3222 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant