[ 
https://issues.apache.org/jira/browse/SPARK-28767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Filipe Oliveira resolved SPARK-28767.
-------------------------------------
    Resolution: Cannot Reproduce

> 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: Max 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
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to