Spark 2.3.1 array_join 和 array_remove

Spark 2.3.1 array_join and array_remove

我已经编写了一个 pyspark 脚本来执行一个 SQL 文件,它在 spark 最新版本上运行得很好,但目标机器有 2.3.1,它抛出异常:

pyspark.sql.utils.AnalysisException: u"Undefined function: 'array_remove'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'

这些似乎在旧版本中不存在:( 谁能提出一些建议,我已经搜索了很多但都是徒劳的。

我的 sql 失败的部分是

SELECT NIEDC.*, array_join(array_remove(split(groupedNIEDC.appearedIn,'-'), StudyCode),'-') AS subjects_assigned_to_other_studies 

array_remove and array_join functions were added on spark version 2.4. You can make an UDF and register it to use in a query using this method.