An array of literals in the hive

How to write 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 an error

 FAILED: ParseException line xx:xx cannot recognize input near '[' '0.5' ',' in select expression 
+6
source share
1 answer

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 
+10
source

Source: https://habr.com/ru/post/975270/


All Articles