[ 
https://issues.apache.org/jira/browse/SPARK-28767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16909712#comment-16909712
 ] 

Maxim Gekk commented on SPARK-28767:
------------------------------------

See the PR where the issue was found: 
[https://github.com/apache/spark/pull/25410#discussion_r314596136]

> ParseException: no viable alternative at input 'year'
> -----------------------------------------------------
>
>                 Key: SPARK-28767
>                 URL: https://issues.apache.org/jira/browse/SPARK-28767
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Maxim Gekk
>            Priority: Minor
>
> The following query in timestamp.sql:
> {code}
> -- !query 13
> SELECT '' AS `54`, d1 as `timestamp`,
>     date_part( 'year', d1) AS year, date_part( 'month', d1) AS month,
>     date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour,
>     date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second
>     FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'
> -- !query 13 schema
> struct<>
> -- !query 13 output
> {code}
> causes the error:
> {code}
> org.apache.spark.sql.catalyst.parser.ParseException
> no viable alternative at input 'year'(line 2, pos 30)
> == SQL ==
> SELECT '' AS `54`, d1 as `timestamp`,
>     date_part( 'year', d1) AS year, date_part( 'month', d1) AS month,
> ------------------------------^^^
>     date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour,
>     date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second
>     FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'
> {code}
> but *year without backquotes* shouldn't throw the exception.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to