9

How do I write out an array literal in Hive?

SELECT PERCENTILE(my_column, [0.5, 0.25, 0.50, 0.75, 0.95]) AS quantiles
FROM my_table

Returns the error

FAILED: ParseException line xx:xx cannot recognize input near '[' '0.5' ',' in select expression
John McDonnell
  • 1,470
  • 2
  • 18
  • 19

1 Answers1

14

Try using array instead of []

SELECT PERCENTILE(my_column, array(0.5, 0.25, 0.50, 0.75, 0.95)) AS quantiles
FROM my_table
FuzzyTree
  • 32,014
  • 3
  • 54
  • 85