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

New API for WIDTH_BUCKET #278

Closed
oleg-bobrov-exa opened this issue Jan 10, 2024 · 0 comments · Fixed by #280
Closed

New API for WIDTH_BUCKET #278

oleg-bobrov-exa opened this issue Jan 10, 2024 · 0 comments · Fixed by #280
Assignees
Labels
feature Product feature

Comments

@oleg-bobrov-exa
Copy link

Please extend the API to include a new scalar function WIDTH_BUCKET.

WIDTH_BUCKET receives 4 arguments: operandbound1bound2 and bucket_count  and assigns operand  to a corresponding bucket. operandbound1 and bound2 must be numeric, bucket_count must be exact numeric with scale = 0.

Examples

SELECT WIDTH_BUCKET(-0.1, 0, 1, 2) E1,
       WIDTH_BUCKET(0, 0, 1, 2) E2,
       WIDTH_BUCKET(0.49, 0, 1, 2) E3,
       WIDTH_BUCKET(0.5, 0, 1, 2) E4,
       WIDTH_BUCKET(0.9, 0, 1, 2) E5,
       WIDTH_BUCKET(1, 0, 1, 2) E6,

       WIDTH_BUCKET(1.1, 1, 0, 2) E7,
       WIDTH_BUCKET(1, 1, 0, 2) E8,
       WIDTH_BUCKET(0.5, 1, 0, 2) E9,
       WIDTH_BUCKET(0.1, 1, 0, 2) E10,
       WIDTH_BUCKET(0, 1, 0, 2) E11,

       WIDTH_BUCKET(null, 0, 1, 2) E12;
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12    
-- -- -- -- -- -- -- -- -- --- --- ------ 
0  1  1  2  2  3  0  1  2  2   3   (null)

New capabilites

FN_WIDTH_BUCKET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants