Skip to content

Conversation

@jonmmease
Copy link
Contributor

Which issue does this PR close?

Closes #6714

What changes are included in this PR?

Adds the Postgres PERCENTILE_CONT aggregation function. Refactors the median aggregation to use the new PercentileContAccumulator with percentile 0.5.

In order to match the precision of the existing median tests I needed to use BigDecimal values for the linear interpolation step.

Are these changes tested?

Yes, tests added to datafusion/core/tests/sqllogictests/test_files/aggregate.slt.

Are there any user-facing changes?

Yes, the percentile_cont aggregation function is now available in SQL

@jonmmease jonmmease marked this pull request as draft June 19, 2023 13:45
@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) labels Jun 19, 2023
@jonmmease jonmmease closed this Jun 19, 2023
@friendlymatthew
Copy link
Contributor

Hi @jonmmease, I'm curious why this was closed

@jonmmease
Copy link
Contributor Author

As I recall, I ran into some precision issue when I tried to re-implement median in terms of percentile_cont, and didn't have the bandwidth to get it across the finish line.

@friendlymatthew
Copy link
Contributor

As I recall, I ran into some precision issue when I tried to re-implement median in terms of percentile_cont, and didn't have the bandwidth to get it across the finish line.

Thank you for clarifying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add percentile_cont aggregation function

2 participants