This is an automated email from the ASF dual-hosted git repository.

houqp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 06bda75  minor: refine code (#1951)
06bda75 is described below

commit 06bda75cfde081bcd9a17454d6e7a164a861ecd1
Author: xudong.w <[email protected]>
AuthorDate: Wed Mar 9 13:42:43 2022 +0800

    minor: refine code (#1951)
---
 datafusion/src/execution/context.rs |  6 ++++--
 datafusion/src/logical_plan/plan.rs |  8 +++++---
 datafusion/src/sql/planner.rs       | 22 +++++-----------------
 3 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/datafusion/src/execution/context.rs 
b/datafusion/src/execution/context.rs
index 72bf131..8c43ecd 100644
--- a/datafusion/src/execution/context.rs
+++ b/datafusion/src/execution/context.rs
@@ -271,9 +271,11 @@ impl ExecutionContext {
                 Ok(Arc::new(DataFrameImpl::new(self.state.clone(), &plan)))
             }
 
-            LogicalPlan::DropTable(DropTable { name, if_exist, .. }) => {
+            LogicalPlan::DropTable(DropTable {
+                name, if_exists, ..
+            }) => {
                 let returned = self.deregister_table(name.as_str())?;
-                if !if_exist && returned.is_none() {
+                if !if_exists && returned.is_none() {
                     Err(DataFusionError::Execution(format!(
                         "Memory table {:?} doesn't exist.",
                         name
diff --git a/datafusion/src/logical_plan/plan.rs 
b/datafusion/src/logical_plan/plan.rs
index 6490730..60d4845 100644
--- a/datafusion/src/logical_plan/plan.rs
+++ b/datafusion/src/logical_plan/plan.rs
@@ -191,7 +191,7 @@ pub struct DropTable {
     /// The table name
     pub name: String,
     /// If the table exists
-    pub if_exist: bool,
+    pub if_exists: bool,
     /// Dummy schema
     pub schema: DFSchemaRef,
 }
@@ -1002,8 +1002,10 @@ impl LogicalPlan {
                     }) => {
                         write!(f, "CreateMemoryTable: {:?}", name)
                     }
-                    LogicalPlan::DropTable(DropTable { name, if_exist, .. }) 
=> {
-                        write!(f, "DropTable: {:?} if not exist:={}", name, 
if_exist)
+                    LogicalPlan::DropTable(DropTable {
+                        name, if_exists, ..
+                    }) => {
+                        write!(f, "DropTable: {:?} if not exist:={}", name, 
if_exists)
                     }
                     LogicalPlan::Explain { .. } => write!(f, "Explain"),
                     LogicalPlan::Analyze { .. } => write!(f, "Analyze"),
diff --git a/datafusion/src/sql/planner.rs b/datafusion/src/sql/planner.rs
index c365ac9..8dd0120 100644
--- a/datafusion/src/sql/planner.rs
+++ b/datafusion/src/sql/planner.rs
@@ -50,10 +50,9 @@ use arrow::datatypes::*;
 use hashbrown::HashMap;
 use sqlparser::ast::{
     BinaryOperator, DataType as SQLDataType, DateTimeField, Expr as SQLExpr, 
FunctionArg,
-    FunctionArgExpr, HiveDistributionStyle, Ident, Join, JoinConstraint, 
JoinOperator,
-    ObjectName, Query, Select, SelectItem, SetExpr, SetOperator, 
ShowStatementFilter,
-    TableFactor, TableWithJoins, TrimWhereField, UnaryOperator, Value,
-    Values as SQLValues,
+    FunctionArgExpr, Ident, Join, JoinConstraint, JoinOperator, ObjectName, 
Query,
+    Select, SelectItem, SetExpr, SetOperator, ShowStatementFilter, TableFactor,
+    TableWithJoins, TrimWhereField, UnaryOperator, Value, Values as SQLValues,
 };
 use sqlparser::ast::{ColumnDef as SQLColumnDef, ColumnOption};
 use sqlparser::ast::{ObjectType, OrderByExpr, Statement};
@@ -150,22 +149,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             Statement::CreateTable {
                 query: Some(query),
                 name,
-                or_replace: false,
                 columns,
                 constraints,
-                hive_distribution: HiveDistributionStyle::NONE,
-                hive_formats: _hive_formats,
                 table_properties,
                 with_options,
-                file_format: None,
-                location: None,
-                like: None,
-                temporary: _temporary,
-                external: false,
-                if_not_exists: false,
-                without_rowid: _without_row_id,
-                engine: _engine,
-                default_charset: _default_charset,
+                ..
             } if columns.is_empty()
                 && constraints.is_empty()
                 && table_properties.is_empty()
@@ -194,7 +182,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             {
                 Ok(LogicalPlan::DropTable(DropTable {
                     name: names.get(0).unwrap().to_string(),
-                    if_exist: *if_exists,
+                    if_exists: *if_exists,
                     schema: DFSchemaRef::new(DFSchema::empty()),
                 }))
             }

Reply via email to