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_r347079478
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/IntervalUtilsSuite.scala
##########
@@ -93,8 +104,18 @@ class IntervalUtilsSuite extends SparkFunSuite {
// Allow duplicated units and summarize their values
checkFromString("1 day 10 day", new CalendarInterval(0, 11, 0))
// Only the seconds units can have the fractional part
- checkFromInvalidString("1.5 days", "Error parsing interval string")
- checkFromInvalidString("1. hour", "Error parsing interval string")
+ checkFromInvalidString("1.5 days", "'days' cannot have fractional part")
+ checkFromInvalidString("1. hour", "'hour' cannot have fractional part")
+ checkFromInvalidString("1 hourX", "invalid unit 'hourx'")
+ checkFromInvalidString("~1 hour", "unrecognized number '~1'")
+ checkFromInvalidString("1 Mour", "invalid unit 'mour'")
+ checkFromInvalidString("1 aour", "invalid unit 'aour'")
+ checkFromInvalidString("1a1 hour", "invalid value '1a1'")
+ checkFromInvalidString("1.1a1 seconds", "invalid value '1.1a1' in
fractional part")
Review comment:
nit: seems like `invalid value '1.1a1'` is more clearer
----------------------------------------------------------------
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]