eliaperantoni commented on issue #13662:
URL: https://github.com/apache/datafusion/issues/13662#issuecomment-2527259854

   > > ```
   > > (line 1, column 8) error: 'users.name' in projection does not appear in 
GROUP BY clause
   > > (line 1, column 33) note: GROUP BY clause is here
   > > (line 1, column 33) Help: Add 'users.name' to GROUP BY clause
   > > ```
   > 
   > Thanks @eliaperantoni But this more looks for as a parse challenge 🤔 
shouldn't be it in the parser phase? 
[apache/datafusion-sqlparser-rs](https://github.com/apache/datafusion-sqlparser-rs)
   
   I think the parser and the logical planner capture different categories of 
errors. They do it already now, just not in a user-friendly way.
   
   The parser would catch errors such as a syntactically invalid query (e.g. 
`SELECT id name FROM users`, missing a comma), while the logical planner would 
catch more sophisticated errors that appear in a grammatically correct query 
(e.g. `SELECT id + name FROM users`, trying to do an arithmetic sum between an 
integer and a string).
   
   Though, you are right that the source location information must come from 
the parser, and we have contributed that here 
[datafusion-sqlparser-rs#1435](https://github.com/apache/datafusion-sqlparser-rs/pull/1435).
 It's just that the parser alone doesn't understand how the AST tree is being 
interpreted, the logical planner does that.
   
   One key consideration is that in #13664 I'm enhancing errors from the 
logical planner only: syntactically invalid queries would still result in a 
user-unfriendly error from datafusion-sqlparser-rs. Perhaps we can, at some 
point, do the same to datafusion-sqlparser-rs too?


-- 
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.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to