Get the last element from Apache Spark SQL split() Function

后端 未结 4 939
太阳男子
太阳男子 2021-02-06 13:54

I want to get the last element from the Array that return from Spark SQL split() function.

split(4:3-2:3-5:4-6:4-5:2,\'-\')

I know it can get b

4条回答
  •  温柔的废话
    2021-02-06 14:20

    Please check substring_index it should work exactly as you want:

    substring_index(lit("1-2-3-4"), "-", -1) // 4
    

提交回复
热议问题