You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simplify percentile_cont to min/max when percentile is 0 or 1 #18108
Is your feature request related to a problem or challenge?
#17988 introduced percentile_cont(). If the specified percentile is 0 or 1, we could rewrite the function to use min/max instead which would be equivalent but with lower memory usage (percentile_cont() by default buffers entire input).
Describe the solution you'd like
Implement simplify() for percentile_cont, based on if fraction is a provided literal that is 0 or 1, rewriting to min/max.
Things to consider:
Consider sort order (percentile of 0 ascending = min, but percentile of 0 descending = max)
Ensure return types match
Does min/max have same null handling? percentile_cont ignores nulls
I gave it a quick shot before I saw your comment. I found it a bit tricky and couldn't quite get the tests to pass for the second syntax (ran into weird schema datatype issues). I'll stop and leave it up to you. Just giving you a heads up about the tricky part. Easy thing to overlook.
Activity
petern48 commentedon Oct 17, 2025
I gave it a quick shot before I saw your comment. I found it a bit tricky and couldn't quite get the tests to pass for the second syntax (ran into weird schema datatype issues). I'll stop and leave it up to you. Just giving you a heads up about the tricky part. Easy thing to overlook.
Simplify percentile_cont for 0/1 percentiles (#18837)