You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2023/04/24 17:44:02 UTC

[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #6096: Support DROP SCHEMA statements

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


##########
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:
   is it possible scenario?



-- 
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-unsubscribe@arrow.apache.org

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