jeff303 commented on issue #26144: [SPARK-27903][SQL] Improve the error 
messages of SQL parser
URL: https://github.com/apache/spark/pull/26144#issuecomment-545189592
 
 
   > Can you show before and after error messages?
   
   Consider two simple queries.
   
   1. `select (r + 1))`
   2. `select ((r + 1)`
   
   
   Before, the error messages would be the following, respectively.
   
   ```
   org.apache.spark.sql.catalyst.parser.ParseException: 
   extraneous input ')' expecting <EOF>(line 1, pos 14)
   
   == SQL ==
   select (r + 1)) 
   --------------^^^
   org.apache.spark.sql.catalyst.parser.ParseException: 
   no viable alternative at input '((r + 1) '(line 1, pos 16)
   
   == SQL ==
   select ((r + 1) 
   ----------------^^^
   ```
   
   After:
   
   ```
   org.apache.spark.sql.catalyst.parser.ParseException: 
   Unbalanced parentheses (extra right)(line 1, pos 14)
   
   == SQL ==
   select (r + 1)) 
   --------------^^^
   
   org.apache.spark.sql.catalyst.parser.ParseException: 
   Unbalanced parentheses (extra left)(line 1, pos 7)
   
   == SQL ==
   select ((r + 1) 
   -------^^^
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to