[
https://issues.apache.org/jira/browse/SPARK-36023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375085#comment-17375085
]
angerszhu commented on SPARK-36023:
-----------------------------------
My fault.
{code:java}
def checkStringIntervalType(targetStartField: Byte, targetEndField: Byte): Unit
= {
if (startField != targetStartField || endField != targetEndField) {
throw new IllegalArgumentException(s"Interval string does not match
day-time format of " +
s"${supportedFormat((targetStartField, targetStartField))
.map(format => s"`$format`").mkString(", ")} " +
s"when cast to ${DT(startField, endField).typeName}: ${input.toString}")
}
}
{code}
Let's fix this inĀ https://github.com/apache/spark/pull/33217
> Confusing error from casting a string to ANSI interval
> ------------------------------------------------------
>
> Key: SPARK-36023
> URL: https://issues.apache.org/jira/browse/SPARK-36023
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 3.2.0
> Reporter: Max Gekk
> Priority: Major
>
> See the example:
> {code:sql}
> spark-sql> select interval '56:12' minute to second;
> 0 00:56:12.000000000
> spark-sql> select cast('56:12' as interval minute to second);
> 21/07/05 22:58:03 ERROR SparkSQLDriver: Failed in [select cast('56:12' as
> interval minute to second)]
> java.lang.IllegalArgumentException: Interval string does not match day-time
> format of `[+|-]h`, `INTERVAL [+|-]'[+|-]h' HOUR` when cast to interval
> minute to second: 56:12
> at
> org.apache.spark.sql.catalyst.util.IntervalUtils$.checkStringIntervalType$2(IntervalUtils.scala:287)
> {code}
> The error message from the second command confuses slightly. It mentions
> INTERVAL HOUR but how it relates to the input?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]