alamb commented on a change in pull request #1959:
URL: https://github.com/apache/arrow-datafusion/pull/1959#discussion_r829069418
##########
File path: datafusion/src/execution/context.rs
##########
@@ -2907,6 +2947,29 @@ mod tests {
assert_eq!(Weak::strong_count(&catalog_weak), 0);
}
+ #[tokio::test]
+ async fn sql_create_schema() -> Result<()> {
+ // the information schema used to introduce cyclic Arcs
Review comment:
not sure what this comment means
##########
File path: datafusion/src/execution/context.rs
##########
@@ -286,6 +285,39 @@ impl ExecutionContext {
Ok(Arc::new(DataFrame::new(self.state.clone(), &plan)))
}
}
+ LogicalPlan::CreateCatalogSchema(CreateCatalogSchema {
+ schema_name,
+ if_not_exists,
+ ..
+ }) => {
+ // sqlparser doesnt accept database / catalog as parameter to
CREATE SCHEMA
+ // so for now, we default to "datafusion" catalog
+ let default_catalog = "datafusion";
+ let catalog = self.catalog(default_catalog).ok_or_else(|| {
+ DataFusionError::Execution(String::from(
+ "Missing 'datafusion' catalog",
+ ))
+ })?;
+
+ let schema = catalog.schema(&schema_name);
+
+ match (if_not_exists, schema) {
Review comment:
👍
##########
File path: datafusion/src/execution/context.rs
##########
@@ -286,6 +285,39 @@ impl ExecutionContext {
Ok(Arc::new(DataFrame::new(self.state.clone(), &plan)))
}
}
+ LogicalPlan::CreateCatalogSchema(CreateCatalogSchema {
+ schema_name,
+ if_not_exists,
+ ..
+ }) => {
+ // sqlparser doesnt accept database / catalog as parameter to
CREATE SCHEMA
Review comment:
maybe worth a ticket to sqlparser to support this? Or maybe just a PR :)
--
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]