You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Move deprecated macros to a deprecated folder
* Move width_bucket into sql generators
* Warn that some more macros will be removed in future
* Fix BQ seed
This macro is modeled after the `width_bucket` function natively available in Snowflake.
1011
+
1012
+
From the original Snowflake [documentation](https://docs.snowflake.net/manuals/sql-reference/functions/width_bucket.html):
1013
+
1014
+
Constructs equi-width histograms, in which the histogram range is divided into intervals of identical size, and returns the bucket number into which the value of an expression falls, after it has been evaluated. The function returns an integer value or null (if any input is null).
1015
+
Notes:
1016
+
1017
+
**Args:**
1018
+
-`expr`: The expression for which the histogram is created. This expression must evaluate to a numeric value or to a value that can be implicitly converted to a numeric value.
1019
+
1020
+
-`min_value` and `max_value`: The low and high end points of the acceptable range for the expression. The end points must also evaluate to numeric values and not be equal.
1021
+
1022
+
-`num_buckets`: The desired number of buckets; must be a positive integer value. A value from the expression is assigned to each bucket, and the function then returns the corresponding bucket number.
1023
+
1024
+
When an expression falls outside the range, the function returns:
1025
+
-`0` if the expression is less than min_value.
1026
+
-`num_buckets + 1` if the expression is greater than or equal to max_value.
This macro is modeled after the `width_bucket` function natively available in Snowflake.
1097
-
1098
-
From the original Snowflake [documentation](https://docs.snowflake.net/manuals/sql-reference/functions/width_bucket.html):
1099
-
1100
-
Constructs equi-width histograms, in which the histogram range is divided into intervals of identical size, and returns the bucket number into which the value of an expression falls, after it has been evaluated. The function returns an integer value or null (if any input is null).
1101
-
Notes:
1102
-
1103
-
**Args:**
1104
-
-`expr`: The expression for which the histogram is created. This expression must evaluate to a numeric value or to a value that can be implicitly converted to a numeric value.
1105
-
1106
-
-`min_value` and `max_value`: The low and high end points of the acceptable range for the expression. The end points must also evaluate to numeric values and not be equal.
1107
-
1108
-
-`num_buckets`: The desired number of buckets; must be a positive integer value. A value from the expression is assigned to each bucket, and the function then returns the corresponding bucket number.
1109
-
1110
-
When an expression falls outside the range, the function returns:
1111
-
-`0` if the expression is less than min_value.
1112
-
-`num_buckets + 1` if the expression is greater than or equal to max_value.
0 commit comments