使用 sql 将字符串转换为数据块中的日期时间格式
Convert string to datetime format in databricks using sql
我在将字符串转换为数据块中的日期时间格式时遇到错误:
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: All week-based patterns are unsupported since Spark 3.0, detected: Y, 请改用SQL函数EXTRACT
在 org.apache.spark.sql.catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4(DateTimeFormatterHelper.scala:323)
在 org.apache.spark.sql.catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4$adapted(DateTimeFormatterHelper.scala:321)
这个命令有效
select to_date(upper('01Jan1971:00:00:00'),'ddMMMyyyy:HH:mm:ss')
我在将字符串转换为数据块中的日期时间格式时遇到错误:
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: All week-based patterns are unsupported since Spark 3.0, detected: Y, 请改用SQL函数EXTRACT 在 org.apache.spark.sql.catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4(DateTimeFormatterHelper.scala:323) 在 org.apache.spark.sql.catalyst.util.DateTimeFormatterHelper$.$anonfun$convertIncompatiblePattern$4$adapted(DateTimeFormatterHelper.scala:321)
这个命令有效
select to_date(upper('01Jan1971:00:00:00'),'ddMMMyyyy:HH:mm:ss')