如何拆分列?

How to split a column?

我想看看是否可以拆分 spark 数据帧中的列。像这样,

Select employee, split(department,"_") from Employee

试试这个:

SELECT explode(split(str, '_'))

或者这样:

SELECT split(str, ' ')[0] as part1, split(str, ' ')[1] as part2