检查一下是否有 from pyspark.sql.functions import * 很可能在使用spark udf时,udf里面的python内置函数被spark function给替代了,重新import即可