标签: apache-spark-sql spark-dataframe
我想看看我是否可以在spark数据帧中拆分列。像这样,
Select employee, split(department,"_") from Employee
答案 0 :(得分:25)
试试这个:
SELECT explode(split(str, '_'))
或者这个:
SELECT split(str, ' ')[0] as part1, split(str, ' ')[1] as part2