Yesheng Ma created SPARK-27912:
----------------------------------

             Summary: Improve parser error message for CASE clause
                 Key: SPARK-27912
                 URL: https://issues.apache.org/jira/browse/SPARK-27912
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: Yesheng Ma


The \{{CASE}} clause is commonly used in SQL queries, but people can forget the 
trailing {{END}}. When a user queries such a statement, the error message is 
confusing. For example, the error message for


{code:sql}
SELECT (CASE WHEN a THEN b ELSE c) FROM a;
{code}

is
{code:java}
no viable alternative at input '(CASE WHEN a THEN b ELSE c)'(line 1, pos 33)
{code}
which is misleading.
 

One possible way to fix is to explicitly capture these statements in a grammar 
rule and print user-friendly error message such as
{code:java}
missing trailing END for case clause
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to