Presto - 插入数组作为函数输入
Presto - Insert Array as Function Input
approx_percentile(x, percentages) → array<[same as x]>
Returns the
approximate percentile for all input values of x at each of the
specified percentages. Each element of the percentages array must be
between zero and one, and the array must be constant for all input
rows.
我想在第 25、第 50、第 75 和第 95 个百分位数处找到 amount
的关联值,假设输出是一个数组,但无法弄清楚如何将这些值提供给函数 (除了提供一个值)。
我已经尝试了我习惯看到的各种表示法,但我一直返回错误。如何输入多个值得到数组输出?
APPROX_PERCENTILE(amount, .25, .50, .75, .95)
APPROX_PERCENTILE(amount, (.25, .50, .75, .95))
APPROX_PERCENTILE(amount, {.25, .50, .75, .95})
APPROX_PERCENTILE(amount, [.25, .50, .75, .95]) '<--- I assumed this was the proper way
APPROX_PERCENTILE(amount, <[.25, .50, .75, .95]>)
APPROX_PERCENTILE(amount, <.25, .50, .75, .95>)
刚弄明白 - 输入数组作为函数参数的正确方法是:
APPROX_PERCENTILE(amount, ARRAY[0.25, 0.50, 0.75, 0.95])
approx_percentile(x, percentages) → array<[same as x]>
Returns the approximate percentile for all input values of x at each of the specified percentages. Each element of the percentages array must be between zero and one, and the array must be constant for all input rows.
我想在第 25、第 50、第 75 和第 95 个百分位数处找到 amount
的关联值,假设输出是一个数组,但无法弄清楚如何将这些值提供给函数 (除了提供一个值)。
我已经尝试了我习惯看到的各种表示法,但我一直返回错误。如何输入多个值得到数组输出?
APPROX_PERCENTILE(amount, .25, .50, .75, .95)
APPROX_PERCENTILE(amount, (.25, .50, .75, .95))
APPROX_PERCENTILE(amount, {.25, .50, .75, .95})
APPROX_PERCENTILE(amount, [.25, .50, .75, .95]) '<--- I assumed this was the proper way
APPROX_PERCENTILE(amount, <[.25, .50, .75, .95]>)
APPROX_PERCENTILE(amount, <.25, .50, .75, .95>)
刚弄明白 - 输入数组作为函数参数的正确方法是:
APPROX_PERCENTILE(amount, ARRAY[0.25, 0.50, 0.75, 0.95])