[ https://issues.apache.org/jira/browse/SPARK-21117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853736#comment-16853736 ]
Yuming Wang commented on SPARK-21117: ------------------------------------- PostgreSQL support this function: ||Function||Return Type||Description||Example||Result|| |width_bucket(operanddp, b1 dp, b2 dp, countint)|int|return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2; returns 0 or count+1 for an input outside the range|width_bucket(5.35, 0.024, 10.06, 5)|3| |width_bucket(operandnumeric, b1 numeric, b2numeric, count int)|int|return the bucket number to which operand would be assigned in a histogram having count equal-width buckets spanning the range b1 to b2; returns 0 or count+1 for an input outside the range|width_bucket(5.35, 0.024, 10.06, 5)|3| |width_bucket(operandanyelement, thresholdsanyarray)|int|return the bucket number to which operand would be assigned given an array listing the lower bounds of the buckets; returns 0 for an input less than the first lower bound; the thresholds array must be sorted, smallest first, or unexpected results will be obtained|width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[])|2| [https://www.postgresql.org/docs/11/functions-math.html] > Built-in SQL Function Support - WIDTH_BUCKET > -------------------------------------------- > > Key: SPARK-21117 > URL: https://issues.apache.org/jira/browse/SPARK-21117 > Project: Spark > Issue Type: Sub-task > Components: SQL > Affects Versions: 2.2.0 > Reporter: Yuming Wang > Priority: Major > Labels: bulk-closed > > For a given expression, the {{WIDTH_BUCKET}} function returns the bucket > number into which the value of this expression would fall after being > evaluated. > {code:sql} > WIDTH_BUCKET (expr , min_value , max_value , num_buckets) > {code} > Ref: > https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2137.htm#OLADM717 -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org