Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20433#discussion_r165259575
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala
 ---
    @@ -561,8 +561,11 @@ class ExpressionParserSuite extends PlanTest {
           Literal(CalendarInterval.fromSingleUnitString(u, s))
         }
     
    -    // Empty interval statement
    -    intercept("interval", "at least one time unit should be given for 
interval literal")
    --- End diff --
    
    yea, antlr just throws an exception when hitting this case;
    ```
    scala> sql("select cast('2018-01-12' as DATE) + 1 days").show
    
+---------------------------------------------------------------------------+
    |CAST(CAST(CAST(2018-01-12 AS DATE) AS TIMESTAMP) + interval 1 days AS 
DATE)|
    
+---------------------------------------------------------------------------+
    |                                                                 
2018-01-13|
    
+---------------------------------------------------------------------------+
    
    scala> sql("select cast('2018-01-12' as DATE) + interval").show
    org.apache.spark.sql.AnalysisException: cannot resolve '`interval`' given 
input columns: []; line 1 pos 36;
    'Project [unresolvedalias((cast(2018-01-12 as date) + 'interval), None)]
    +- OneRowRelation
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to