Skip to content

Apache DataFusion SQL Query Engine

ARROW-4892: [Rust] [DataFusion] Move SQL parser and planner into SQL module

Andy Grove1ee06e842bd0
diff --git a/rust/datafusion/src/execution/context.rs b/rust/datafusion/src/execution/context.rs
index b5390847cf..b1ebf40ab3 100644
--- a/rust/datafusion/src/execution/context.rs
+++ b/rust/datafusion/src/execution/context.rs
@@ -27,7 +27,6 @@ use arrow::datatypes::*;
use crate::datasource::csv::CsvFile;
use crate::datasource::datasource::Table;
-use crate::dfparser::{DFASTNode, DFParser};
use crate::execution::aggregate::AggregateRelation;
use crate::execution::error::{ExecutionError, Result};
use crate::execution::expression::*;
@@ -38,7 +37,8 @@ use crate::execution::relation::{DataSourceRelation, Relation};
use crate::logicalplan::*;
use crate::optimizer::optimizer::OptimizerRule;
use crate::optimizer::projection_push_down::ProjectionPushDown;
-use crate::sqlplanner::{SchemaProvider, SqlToRel};
+use crate::sql::parser::{DFASTNode, DFParser};
+use crate::sql::planner::{SchemaProvider, SqlToRel};
pub struct ExecutionContext {
datasources: Rc<RefCell<HashMap<String, Rc<Table>>>>,
diff --git a/rust/datafusion/src/lib.rs b/rust/datafusion/src/lib.rs
index 7fab04620e..63f4ab77b2 100644
--- a/rust/datafusion/src/lib.rs
+++ b/rust/datafusion/src/lib.rs
@@ -25,8 +25,7 @@ extern crate serde_json;
extern crate sqlparser;
pub mod datasource;
-pub mod dfparser;
pub mod execution;
pub mod logicalplan;
pub mod optimizer;
-pub mod sqlplanner;
+pub mod sql;
diff --git a/rust/datafusion/src/sql/mod.rs b/rust/datafusion/src/sql/mod.rs
new file mode 100644
index 0000000000..77a076788c
--- /dev/null
+++ b/rust/datafusion/src/sql/mod.rs
@@ -0,0 +1,21 @@
+// 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.
+
+//! SQL parser and query planner
+
+pub mod parser;
+pub mod planner;
diff --git a/rust/datafusion/src/dfparser.rs b/rust/datafusion/src/sql/parser.rs
similarity index 100%
rename from rust/datafusion/src/dfparser.rs
rename to rust/datafusion/src/sql/parser.rs
diff --git a/rust/datafusion/src/sqlplanner.rs b/rust/datafusion/src/sql/planner.rs
similarity index 99%
rename from rust/datafusion/src/sqlplanner.rs
rename to rust/datafusion/src/sql/planner.rs
index cc988060c5..a463b4cd49 100644
--- a/rust/datafusion/src/sqlplanner.rs
+++ b/rust/datafusion/src/sql/planner.rs
@@ -21,8 +21,8 @@ use std::collections::HashSet;
use std::string::String;
use std::sync::Arc;
-use super::execution::error::*;
-use super::logicalplan::*;
+use crate::execution::error::*;
+use crate::logicalplan::*;
use arrow::datatypes::*;