cloud-fan commented on a change in pull request #26815: [SPARK-30189][SQL]
Interval from year-month/date-time string should handle whitespaces
URL: https://github.com/apache/spark/pull/26815#discussion_r390230002
##########
File path: sql/core/src/test/resources/sql-tests/results/ansi/interval.sql.out
##########
@@ -804,6 +804,51 @@ struct<INTERVAL '1 days':interval>
1 days
+-- !query
+select interval '2-2\t' year to month
+-- !query schema
+struct<INTERVAL '2 years 2 months':interval>
+-- !query output
+2 years 2 months
+
+
+-- !query
+select interval '-\t2-2\t' year to month
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.parser.ParseException
+
+Interval string does not match year-month format of 'y-m': - 2-2 (line
1, pos 16)
+
+== SQL ==
+select interval '-\t2-2\t' year to month
+----------------^^^
+
+
+-- !query
+select interval '\n0 12:34:46.789\t' day to second
+-- !query schema
+struct<INTERVAL '12 hours 34 minutes 46.789 seconds':interval>
+-- !query output
+12 hours 34 minutes 46.789 seconds
+
+
+-- !query
+select interval '\n-\t10\t 12:34:46.789\t' day to second
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.parser.ParseException
+
+requirement failed: Interval string must match day-time format of
'^(?<sign>[+|-])?(?<day>\d+)
(?<hour>\d{1,2}):(?<minute>\d{1,2}):(?<second>(\d{1,2})(\.(\d{1,9}))?)$':
+- 10 12:34:46.789 , set
spark.sql.legacy.fromDayTimeString.enabled to true to restore the behavior
before Spark 3.0.(line 1, pos 16)
Review comment:
not related to this PR, but we should only ask users to set the legacy
config if it works.
----------------------------------------------------------------
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]