Skip to content

Simplify percentile_cont to min/max when percentile is 0 or 1 #18108

@Jefffrey

Description

@Jefffrey

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

See this comment for reference: #17988 (comment)

Describe alternatives you've considered

If not feasible we can skip doing this.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions