ven*_*at 4 sql apache-spark apache-spark-sql pyspark azure-databricks
我试图在 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”时没有可行的替代方案(\n选择id,\n typepid,以防\n当dttm为空或dttm =''然后强制转换('1900-01-01 00:00:00.000作为时间戳)\n 以 dttm\n 结尾,来自 dde_pre_file_user_supp\n )'
我可以在数据块中使用WITH子句吗还是有其他选择吗?
小智 6
我已经提到了可能导致\xe2\x80\x98no 可行替代方案 at input\xe2\x80\x99 错误的原因:
\n输入 \xe2\x80\x98 错误中的 \xe2\x80\x98no 可行替代方案\ xe2\x80\x99 没有提及我们使用了哪个不正确的字符。
\n参考piotrwest的这个答案
\n另请参考这篇文章
\n| 归档时间: | 
 | 
| 查看次数: | 46035 次 | 
| 最近记录: |