cloud-fan commented on a change in pull request #26491: [SPARK-29870][SQL]
Unify the logic of multi-units interval string to CalendarInterval
URL: https://github.com/apache/spark/pull/26491#discussion_r346685009
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -547,14 +478,16 @@ object IntervalUtils {
case ' ' =>
fraction /= NANOS_PER_MICROS.toInt
state = TRIM_BEFORE_UNIT
- case _ => return null
+ case _ if '0' <= b && b <= '9' =>
+ throwIAE(s"invalid value fractional part '$fraction$nextWord'
out of range")
+ case _ => throwIAE(s"invalid value '$nextWord' in fractional part")
}
i += 1
case TRIM_BEFORE_UNIT => trimToNextState(b, UNIT_BEGIN)
case UNIT_BEGIN =>
// Checks that only seconds can have the fractional part
if (b != 's' && fractionScale >= 0) {
- return null
+ throwIAE(s"'$nextWord' with fractional part is unsupported")
Review comment:
nit: `$nextWord' cannot have fractional part`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]