在 databricks 中將字串轉換為日期時間格式時遇到錯誤:
select to_date('01Jan1971:00:00:00','DDMONYYYY:HH:MI:SS')
Error in SQL statement: IllegalArgumentException: All week-based patterns are unsupported since Spark 3.0, detected: Y, Please use the SQL function EXTRACT instead
com.databricks.backend.common.rpc.DatabricksExceptions$SQLExecutionException:java.lang.IllegalArgumentException:自 Spark 3.0 起,所有基于周的模式均不受支持,檢測到:Y,請在 org.apache.spark.sql 中使用 SQL 函式 EXTRACT .catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4(DateTimeFormatterHelper.scala:323) at org.apache.spark.sql.catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4$adapted(DateTimeFormatterHelper.scala:321)
uj5u.com熱心網友回復:
該命令有效
select to_date(upper('01Jan1971:00:00:00'),'ddMMMyyyy:HH:mm:ss')
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/435943.html
