我试图在 Azure 数据块中运行以下查询。
query=s"""WITH pre_file_user AS(
SELECT id,
typeid,
CASE when dttm is null or dttm='' then cast('1900-01-01 00:00:00.000' as timestamp)
else cast(dttm as timestamp)
end as dttm
from dde_pre_file_user_supp
)"""
spark.sql(query)
Run Code Online (Sandbox Code Playgroud)
然后我收到以下错误
ParseException:在输入“with pre_file_users AS”时没有可行的替代方案(\n选择id,\n typepid,以防\n当dttm为空或dttm =''然后强制转换('1900-01-01 00:00:00.000作为时间戳)\n 以 dttm\n 结尾,来自 dde_pre_file_user_supp\n )'
我可以在数据块中使用WITH子句吗还是有其他选择吗?