alamb commented on code in PR #6121:
URL: https://github.com/apache/arrow-datafusion/pull/6121#discussion_r1177017771
##########
datafusion/core/src/execution/context.rs:
##########
@@ -628,6 +488,159 @@ impl SessionContext {
self.return_empty_dataframe()
}
+ async fn create_memory_table(&self, cmd: CreateMemoryTable) ->
Result<DataFrame> {
Review Comment:
Moved from above
##########
datafusion/expr/src/lib.rs:
##########
@@ -66,20 +66,7 @@ pub use function::{
StateTypeFunction,
};
pub use literal::{lit, lit_timestamp_nano, Literal, TimestampLiteral};
-pub use logical_plan::{
- builder::{
- build_join_schema, union, wrap_projection_for_join_if_necessary,
UNNAMED_TABLE,
- },
- Aggregate, Analyze, CreateCatalog, CreateCatalogSchema,
CreateExternalTable,
- CreateMemoryTable, CreateView, CrossJoin, DescribeTable, Distinct,
DmlStatement,
- DropTable, DropView, EmptyRelation, Explain, Extension, Filter, Join,
JoinConstraint,
- JoinType, Limit, LogicalPlan, LogicalPlanBuilder, Partitioning, PlanType,
Prepare,
- Projection, Repartition, SetVariable, Sort, Statement, StringifiedPlan,
Subquery,
- SubqueryAlias, TableScan, ToStringifiedPlan, TransactionAccessMode,
- TransactionConclusion, TransactionEnd, TransactionIsolationLevel,
TransactionStart,
- Union, Unnest, UserDefinedLogicalNode, UserDefinedLogicalNodeCore, Values,
Window,
- WriteOp,
-};
+pub use logical_plan::*;
Review Comment:
this code was just re-exporting all the names in logical_plan anyways so I
reduced the duplication
##########
datafusion/core/src/execution/context.rs:
##########
@@ -351,88 +352,19 @@ impl SessionContext {
}
self.return_empty_dataframe()
}
- LogicalPlan::CreateExternalTable(cmd) => {
- self.create_external_table(&cmd).await
- }
-
- LogicalPlan::CreateMemoryTable(CreateMemoryTable {
Review Comment:
I moved this code into separate methods as this particular dispatch method
was getting quite large
##########
datafusion/core/src/physical_plan/planner.rs:
##########
@@ -1087,13 +1087,14 @@ impl DefaultPhysicalPlanner {
let schema =
SchemaRef::new(schema.as_ref().to_owned().into());
Ok(Arc::new(UnnestExec::new(input, column_exec, schema)))
}
- LogicalPlan::CreateExternalTable(_) => {
- // There is no default plan for "CREATE EXTERNAL
- // TABLE" -- it must be handled at a higher level (so
- // that the appropriate table can be registered with
+ LogicalPlan::Ddl(ddl) => {
Review Comment:
I think this reduction of repetition makes the intent of the code clearer
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1190,28 +1130,6 @@ pub enum JoinConstraint {
Using,
}
-/// Creates a catalog (aka "Database").
Review Comment:
moved to `ddl.rs`
##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -0,0 +1,233 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion_common::Column;
+use datafusion_common::{
+ parsers::CompressionTypeVariant, DFSchemaRef, OwnedTableReference,
+};
+use std::collections::HashMap;
+use std::sync::Arc;
+use std::{
+ fmt::{self, Display},
+ hash::{Hash, Hasher},
+};
+
+use crate::{Expr, LogicalPlan};
+
+/// Various types of DDL (CREATE / DROP) catalog manipulation
+#[derive(Clone, PartialEq, Eq, Hash)]
+pub enum DdlStatement {
Review Comment:
This is the new wrapper enum
--
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]