Home > Net >  Equivalent function to pyspark.sql.functions.posexplode in presto?
Equivalent function to pyspark.sql.functions.posexplode in presto?

Time:11-04

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.

CodePudding user response:

Update - I have found the answer

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