Or import the object, as you know, and use it to access the method:
import org.apache.spark.sql.functions; df.withColumn("foo", functions.lit(1));
or use import static and the call method directly:
import static org.apache.spark.sql.functions.lit; df.withColumn("foo", lit(1));
zero323
source share