我正在运行下面的 pyspark 查询
它抛出以下错误。我希望动态值通过 varaibale 传递到 case 语句中
data1 = 'HI'
data2 = 'HELLO'
spark.sql(f""" select Initials,
case when Initials in ('AM','NJ') then {data1} else {data2} end as s
from omegawriter""").display()
我收到以下错误
A column or function parameter with name `HI` cannot be resolved.
Project [Initials#69, CASE WHEN Initials#69 IN (AM,NJ) THEN 'HI ELSE 'HELLO END AS s#57]
我不明白这个查询有什么问题。有人能帮助我吗
1 个回答