Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27170

Better error message for syntax error with extraneous comma in the SQL parser

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Minor
    • Resolution: Not A Problem
    • 2.4.0
    • None
    • SQL
    • None

    Description

      maropu, smilegator

      It was great to talk with you in Hadoop / Spark Conference Japan 2019.
      Thanks in advance!
      I filed this issue which I talked with you at that time.

      We sometimes write a syntax error SQL with extraneous comma by mistake.
      For example, here is the SQL with an extraneous comma in line 2.

      SELECT distinct
      ,a
      ,b
      ,c
      FROM ...' LIMIT 100
      

      We have an error message in spark 2.4.0 but it's a little hard to understand in my feeling because line number is wrong.

      cannot resolve '`distinct`' given input columns: [...]; line 1 pos 7;
      'GlobalLimit 100
      +- 'LocalLimit 100
      +- 'Project ['distinct, ...]
      +- Filter (...)
      +- SubqueryAlias ...
      +- HiveTableRelation ...
      

      By the way, here is the error message in prestosql 305 and same sql.
      Line number is correct and I guess an error message is better than sparksql.

      line 2:5: mismatched input ','. Expecting: '*', <expression>, <identifier>
      

      If sparksql error message improves, it would be great.

      Thanks.
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            wyukawa Wataru Yukawa
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: