Search code examples
apache-sparkpysparkhivepresto

Equivalent function to pyspark.sql.functions.posexplode in presto?


Would anyone know if there in an equivalent function similar to the pyspark function pyspark.sql.functions.posexplode() in presto?

I am trying to explode and array with its index. I am aware of the existence of UNNEST(). However, this does not store the index of the value in the array.


Solution

  • Update - I have found the answer

    CROSS JOIN UNNEST('col_wth_array') 
        WITH ORDINALITY AS t ('value', 'position');