selecting a range of elements in an array spark sql

后端 未结 8 554
闹比i
闹比i 2020-12-14 23:16

I use spark-shell to do the below operations.

Recently loaded a table with an array column in spark-sql .

Here is the DDL for the same:

8条回答
  •  独厮守ぢ
    2020-12-15 00:20

    use selecrExpr() and split() function in apache spark.

    for example :

    fs.selectExpr("((split(emp_details, ','))[0]) as e1,((split(emp_details, ','))[1]) as e2,((split(emp_details, ','))[2]) as e3);
    

提交回复
热议问题