我尝试在 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)
然后我收到以下错误
ParseException:在输入“with pre_file_users AS”时没有可行的替代方案 ( 选择 ID, 典型的,以防万一 当 dttm 为 null 或 dttm = '' 时 演员('1900-01-01 00:00:00.000 作为时间戳) 以 dttm 结尾 从 dde_pre_file_user_supp )'
我可以在数据块中使用WITH子句吗?还是有其他选择吗?