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

How to implement approx_percentile UDAF #30

Open
superrookiem opened this issue Sep 3, 2022 · 0 comments
Open

How to implement approx_percentile UDAF #30

superrookiem opened this issue Sep 3, 2022 · 0 comments

Comments

@superrookiem
Copy link

SQL Like:
select approx_percentile(c1, 0.1) from testtable;

Python Like:
import numpy as np

a = np.array([1,2,3,4,5,6,7,8,9,10])

print(np.median(a))
print(np.percentile(a,10))
print(np.percentile(a,20))
print(np.percentile(a,30))
print(np.percentile(a,40))
print(np.percentile(a,50))
print(np.percentile(a,60))
print(np.percentile(a,70))
print(np.percentile(a,80))
print(np.percentile(a,90))

Thanks!

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

No branches or pull requests

1 participant