Apache Presto - Array Operator


Following are the types of Array operators.

Array subscript[] Operator

Query

presto:default> select array[1,2,3] as array_elements; 

Result

array_elements 
---------------- 
 [1, 2, 3] 

Array subscript operator returns array elements.

Array Concatenation Operator

Query

presto:default> select array[1,2,3] || array[4] as array_concat; 

Result

 array_concat 
-------------- 
 [1, 2, 3, 4]

Here, two arrays are concatenated with one array.

apache_presto_basic_sql_operations.htm
Advertisements