Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27901 Improve the error messages of SQL parser
  3. SPARK-27903

Improve parser error message for mismatched parentheses in expressions

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      When parentheses are mismatched in expressions in queries, the error message is confusing. This is especially true for large queries, where mismatched parens are tedious for human to figure out.

      For example, the error message for

       
      SELECT ((x + y) * z FROM t; 
      

      is

       
      mismatched input 'FROM' expecting ','(line 1, pos 20) 
      

      One possible way to fix is to explicitly capture such kind of mismatched parens in a grammar rule and print user-friendly error message such as

       
      mismatched parentheses for expression 'SELECT ((x + y) * z FROM t;'(line 1, pos 20) 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                manifoldQAQ Yesheng Ma
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: