jaylmiller commented on code in PR #6096:
URL: https://github.com/apache/arrow-datafusion/pull/6096#discussion_r1175684299


##########
datafusion/core/src/execution/context.rs:
##########
@@ -447,6 +447,31 @@ impl SessionContext {
                 }
             }
 
+            LogicalPlan::DropCatalogSchema(DropCatalogSchema {
+                name,
+                if_exists,
+                cascade,
+                ..
+            }) => {
+                let (dereg, schema) = self.find_and_deregister_schema(&name, 
cascade)?;
+                match (if_exists, schema, dereg) {
+                    // successful deregsiter
+                    (_, _, true) => self.return_empty_dataframe(),
+                    // schema found but failed to deregister
+                    (_, Some(schema), false) => 
Err(DataFusionError::Execution(format!(
+                        "Cannot drop schema {} because other tables depend on 
it: {}",
+                        name,
+                        itertools::join(schema.table_names().iter(), ", ")
+                    ))),
+                    // no schema found
+                    (false, None, false) => 
Err(DataFusionError::Execution(format!(
+                        "Schema '{name}' doesn't exist."
+                    ))),
+                    // no schema found but dont return error

Review Comment:
   This scenario would occur for a statement like `DROP SCHEMA does_not_exist`



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