exasol / virtual-schema-common-java

Common part of all Exasol Virtual Schema
MIT License
1 stars 5 forks source link

New API for WIDTH_BUCKET #278

Closed oleg-bobrov-exa closed 4 months ago

oleg-bobrov-exa commented 8 months ago

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