You should either use
df.select(func.lit(20))
or
df.selectExpr("20")
selectExpr
expects a raw SQL string that can be selected, while select
expects a column
object, such as func.lit(20)
, or a column name as a string.
column
s should not be used in selectExpr
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…