dongjoon-hyun commented on a change in pull request #26438: [SPARK-29408][SQL] 
Support sign before `interval` in interval literals
URL: https://github.com/apache/spark/pull/26438#discussion_r344470755
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala
 ##########
 @@ -433,10 +433,13 @@ class ExpressionParserSuite extends AnalysisTest {
     intercept("timestamP '2016-33-11 20:54:00.000'", "Cannot parse the 
TIMESTAMP value")
 
     // Interval.
-    val intervalLiteral = Literal(IntervalUtils.fromString("interval 3 month 1 
hour"))
+    var intervalLiteral = Literal(IntervalUtils.fromString("interval 3 month 1 
hour"))
     assertEqual("InterVal 'interval 3 month 1 hour'", intervalLiteral)
     assertEqual("INTERVAL '3 month 1 hour'", intervalLiteral)
     intercept("Interval 'interval 3 monthsss 1 hoursss'", "Cannot parse the 
INTERVAL value")
+    assertEqual("+interval '3 month 1 hour'", intervalLiteral)
+    intervalLiteral = Literal(IntervalUtils.fromString("interval -3 month -1 
hour"))
+    assertEqual("-interval '3 month 1 hour'", intervalLiteral)
 
 Review comment:
   If you don't mind, let's use `val intervalLiteral2` instead of touching line 
436.
   ```scala
   -    intervalLiteral = Literal(IntervalUtils.fromString("interval -3 month 
-1 hour"))
   -    assertEqual("-interval '3 month 1 hour'", intervalLiteral)
   +    val intervalLiteral2 = Literal(IntervalUtils.fromString("interval -3 
month -1 hour"))
   +    assertEqual("-interval '3 month 1 hour'", intervalLiteral2)
   ```

----------------------------------------------------------------
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]

Reply via email to