You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maxim Gekk (JIRA)" <ji...@apache.org> on 2019/08/17 13:44:00 UTC

[jira] [Created] (SPARK-28767) ParseException: no viable alternative at input 'year'

Maxim Gekk created SPARK-28767:
----------------------------------

             Summary: 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


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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org