How to access values in array column?

后端 未结 4 758
眼角桃花
眼角桃花 2021-02-04 03:18

I have a Dataframe with one column. Each row of that column has an Array of String values:

Values in my Spark 2.2 Dataframe

[\"123\", \"abc\", \"2017\         


        
4条回答
  •  无人共我
    2021-02-04 04:10

     df.where($"col".getItem(2) === lit("2017")).select($"col".getItem(3))
    

    see getItem from https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.Column

提交回复
热议问题