Hello, I am working on an SQL editor which is powered by spark SQL. When the SQL is not valid, I would like to provide the user with a line number and column number where the first error occurred. I am having a hard time finding a mechanism that will give me that information programmatically.
Most of the time, if an erroneous SQL statement is used, I am getting a RuntimeException, where line number and column number are implicitly embedded within the text of the message, but it is really error prone to parse the message text and count the number of spaces prior to the '^' symbol... Sometimes, AnalysisException is used, but when I try to extract the line and startPosition from it, they are always empty. Any help would be greatly appreciated. thanks!