HaoYang670 commented on PR #4429:
URL: 
https://github.com/apache/arrow-datafusion/pull/4429#issuecomment-1331635067

   > Hi @HaoYang670 please check the PR But tbh the optimizer doesn't respect 
errors now so the error message looks like
   > 
   > ```
   > DataFusion CLI v14.0.0
   > ❯ explain explain select 1;
   > Internal("Unsupported logical plan: Explain must be root of the plan")
   > ```
   
   Thank you for your contribution @comphead .
   This is because the error is generated in the logical optimizer, but it is 
ignored as the configuration `datafusion.optimizer.skip_failed_rules` is set to 
`true in default: 
   
https://github.com/apache/arrow-datafusion/blob/49166ea55f317722ab7a37fbfc253bcd497c1672/datafusion/optimizer/src/optimizer.rs#L248-L265
   
   And the error message printed in CLI is created when generating physical 
plan:
   
https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/src/physical_plan/planner.rs#L1093-L1095
   
   Generally, we don't want to return an internal error to user, because it 
means that there are bugs in our project.
   For the `expain explain ... ` query, if it is invalid, we should return an 
error when parsing it, instead of when optimizing it.
   
   cc @andygrove. Should this bug be fixed in sqlparser-rs or in datafusion?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to