You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2019/03/18 11:27:22 UTC

[arrow] branch master updated: ARROW-4895: [Rust] [DataFusion] Move error.rs to root of crate

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d6fa8a8  ARROW-4895: [Rust] [DataFusion] Move error.rs to root of crate
d6fa8a8 is described below

commit d6fa8a8fc8eddee84c752f411edaf875350d4a3b
Author: Andy Grove <an...@gmail.com>
AuthorDate: Mon Mar 18 12:27:13 2019 +0100

    ARROW-4895: [Rust] [DataFusion] Move error.rs to root of crate
    
    The `error.rs` file was under the `execution` module even though this is the error type used across the crate, so I moved it to the top level.
    
    Author: Andy Grove <an...@gmail.com>
    
    Closes #3950 from andygrove/ARROW-4895 and squashes the following commits:
    
    f1d5bc02 <Andy Grove> formatting
    cf30d126 <Andy Grove> Move error.rs to root of crate
---
 rust/datafusion/src/datasource/csv.rs        |  2 +-
 rust/datafusion/src/datasource/datasource.rs |  2 +-
 rust/datafusion/src/datasource/memory.rs     |  2 +-
 rust/datafusion/src/datasource/parquet.rs    |  2 +-
 rust/datafusion/src/{execution => }/error.rs | 17 +++++++++++++----
 rust/datafusion/src/execution/aggregate.rs   |  2 +-
 rust/datafusion/src/execution/context.rs     |  2 +-
 rust/datafusion/src/execution/expression.rs  |  6 +++---
 rust/datafusion/src/execution/filter.rs      |  6 +++---
 rust/datafusion/src/execution/limit.rs       |  4 ++--
 rust/datafusion/src/execution/mod.rs         |  1 -
 rust/datafusion/src/execution/projection.rs  |  2 +-
 rust/datafusion/src/execution/relation.rs    |  2 +-
 rust/datafusion/src/lib.rs                   |  1 +
 rust/datafusion/src/sql/planner.rs           |  2 +-
 15 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/rust/datafusion/src/datasource/csv.rs b/rust/datafusion/src/datasource/csv.rs
index a010526..79b3cd2 100644
--- a/rust/datafusion/src/datasource/csv.rs
+++ b/rust/datafusion/src/datasource/csv.rs
@@ -26,7 +26,7 @@ use arrow::datatypes::{Field, Schema};
 use arrow::record_batch::RecordBatch;
 
 use crate::datasource::{RecordBatchIterator, ScanResult, Table};
-use crate::execution::error::Result;
+use crate::error::Result;
 
 /// Represents a CSV file with a provided schema
 pub struct CsvFile {
diff --git a/rust/datafusion/src/datasource/datasource.rs b/rust/datafusion/src/datasource/datasource.rs
index 7e48f19..7db351e 100644
--- a/rust/datafusion/src/datasource/datasource.rs
+++ b/rust/datafusion/src/datasource/datasource.rs
@@ -22,7 +22,7 @@ use std::sync::{Arc, Mutex};
 use arrow::datatypes::Schema;
 use arrow::record_batch::RecordBatch;
 
-use crate::execution::error::Result;
+use crate::error::Result;
 
 pub type ScanResult = Arc<Mutex<RecordBatchIterator>>;
 
diff --git a/rust/datafusion/src/datasource/memory.rs b/rust/datafusion/src/datasource/memory.rs
index e5955e5..e12bec5 100644
--- a/rust/datafusion/src/datasource/memory.rs
+++ b/rust/datafusion/src/datasource/memory.rs
@@ -25,7 +25,7 @@ use arrow::datatypes::{Field, Schema};
 use arrow::record_batch::RecordBatch;
 
 use crate::datasource::{RecordBatchIterator, ScanResult, Table};
-use crate::execution::error::{ExecutionError, Result};
+use crate::error::{ExecutionError, Result};
 
 /// In-memory table
 pub struct MemTable {
diff --git a/rust/datafusion/src/datasource/parquet.rs b/rust/datafusion/src/datasource/parquet.rs
index 3fb4a3c..d017810 100644
--- a/rust/datafusion/src/datasource/parquet.rs
+++ b/rust/datafusion/src/datasource/parquet.rs
@@ -32,7 +32,7 @@ use parquet::file::reader::*;
 use parquet::reader::schema::parquet_to_arrow_schema;
 
 use crate::datasource::{RecordBatchIterator, ScanResult, Table};
-use crate::execution::error::{ExecutionError, Result};
+use crate::error::{ExecutionError, Result};
 
 pub struct ParquetTable {
     filename: String,
diff --git a/rust/datafusion/src/execution/error.rs b/rust/datafusion/src/error.rs
similarity index 86%
rename from rust/datafusion/src/execution/error.rs
rename to rust/datafusion/src/error.rs
index b734e6b..26d48b1 100644
--- a/rust/datafusion/src/execution/error.rs
+++ b/rust/datafusion/src/error.rs
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Error types
+//! DataFusion error types
 
 use std::io::Error;
 use std::result;
@@ -27,17 +27,26 @@ use sqlparser::sqlparser::ParserError;
 
 pub type Result<T> = result::Result<T, ExecutionError>;
 
-/// DataFusion execution error
+/// DataFusion error
 #[derive(Debug)]
 pub enum ExecutionError {
+    /// Wraps an error from the Arrow crate
+    ArrowError(ArrowError),
+    /// Wraps an error from the Parquet crate
+    ParquetError(ParquetError),
+    /// I/O error
     IoError(Error),
+    /// SQL parser error
     ParserError(ParserError),
+    /// General error
     General(String),
+    /// Invalid column error
     InvalidColumn(String),
+    /// Missing functionality
     NotImplemented(String),
+    /// Internal error
     InternalError(String),
-    ArrowError(ArrowError),
-    ParquetError(ParquetError),
+    /// Query engine execution error
     ExecutionError(String),
 }
 
diff --git a/rust/datafusion/src/execution/aggregate.rs b/rust/datafusion/src/execution/aggregate.rs
index d982e39..aec187f 100644
--- a/rust/datafusion/src/execution/aggregate.rs
+++ b/rust/datafusion/src/execution/aggregate.rs
@@ -29,7 +29,7 @@ use arrow::compute;
 use arrow::datatypes::{DataType, Schema};
 use arrow::record_batch::RecordBatch;
 
-use crate::execution::error::{ExecutionError, Result};
+use crate::error::{ExecutionError, Result};
 use crate::execution::expression::{AggregateType, RuntimeExpr};
 use crate::execution::relation::Relation;
 use crate::logicalplan::ScalarValue;
diff --git a/rust/datafusion/src/execution/context.rs b/rust/datafusion/src/execution/context.rs
index 5f40786..4413ff9 100644
--- a/rust/datafusion/src/execution/context.rs
+++ b/rust/datafusion/src/execution/context.rs
@@ -27,8 +27,8 @@ use arrow::datatypes::*;
 
 use crate::datasource::csv::CsvFile;
 use crate::datasource::datasource::Table;
+use crate::error::{ExecutionError, Result};
 use crate::execution::aggregate::AggregateRelation;
-use crate::execution::error::{ExecutionError, Result};
 use crate::execution::expression::*;
 use crate::execution::filter::FilterRelation;
 use crate::execution::limit::LimitRelation;
diff --git a/rust/datafusion/src/execution/expression.rs b/rust/datafusion/src/execution/expression.rs
index 5b01af5..6f10d88 100644
--- a/rust/datafusion/src/execution/expression.rs
+++ b/rust/datafusion/src/execution/expression.rs
@@ -25,9 +25,9 @@ use arrow::compute;
 use arrow::datatypes::{DataType, Schema};
 use arrow::record_batch::RecordBatch;
 
-use super::super::logicalplan::{Expr, Operator, ScalarValue};
-use super::context::ExecutionContext;
-use super::error::{ExecutionError, Result};
+use crate::error::{ExecutionError, Result};
+use crate::execution::context::ExecutionContext;
+use crate::logicalplan::{Expr, Operator, ScalarValue};
 
 /// Compiled Expression (basically just a closure to evaluate the expression at runtime)
 pub type CompiledExpr = Rc<Fn(&RecordBatch) -> Result<ArrayRef>>;
diff --git a/rust/datafusion/src/execution/filter.rs b/rust/datafusion/src/execution/filter.rs
index 5100f26..395a894 100644
--- a/rust/datafusion/src/execution/filter.rs
+++ b/rust/datafusion/src/execution/filter.rs
@@ -26,9 +26,9 @@ use arrow::compute::array_ops::filter;
 use arrow::datatypes::Schema;
 use arrow::record_batch::RecordBatch;
 
-use super::error::{ExecutionError, Result};
-use super::expression::RuntimeExpr;
-use super::relation::Relation;
+use crate::error::{ExecutionError, Result};
+use crate::execution::expression::RuntimeExpr;
+use crate::execution::relation::Relation;
 
 /// Implementation of a filter relation
 pub(super) struct FilterRelation {
diff --git a/rust/datafusion/src/execution/limit.rs b/rust/datafusion/src/execution/limit.rs
index 80d70fe..b861139 100644
--- a/rust/datafusion/src/execution/limit.rs
+++ b/rust/datafusion/src/execution/limit.rs
@@ -26,8 +26,8 @@ use arrow::compute::array_ops::limit;
 use arrow::datatypes::Schema;
 use arrow::record_batch::RecordBatch;
 
-use super::error::{ExecutionError, Result};
-use super::relation::Relation;
+use crate::error::{ExecutionError, Result};
+use crate::execution::relation::Relation;
 
 /// Implementation of a LIMIT relation
 pub(super) struct LimitRelation {
diff --git a/rust/datafusion/src/execution/mod.rs b/rust/datafusion/src/execution/mod.rs
index 0ece1e9..475c5b7 100644
--- a/rust/datafusion/src/execution/mod.rs
+++ b/rust/datafusion/src/execution/mod.rs
@@ -19,7 +19,6 @@
 
 pub mod aggregate;
 pub mod context;
-pub mod error;
 pub mod expression;
 pub mod filter;
 pub mod limit;
diff --git a/rust/datafusion/src/execution/projection.rs b/rust/datafusion/src/execution/projection.rs
index 5c95c65..2309897 100644
--- a/rust/datafusion/src/execution/projection.rs
+++ b/rust/datafusion/src/execution/projection.rs
@@ -28,7 +28,7 @@ use arrow::array::ArrayRef;
 use arrow::datatypes::{Field, Schema};
 use arrow::record_batch::RecordBatch;
 
-use crate::execution::error::Result;
+use crate::error::Result;
 use crate::execution::expression::RuntimeExpr;
 use crate::execution::relation::Relation;
 
diff --git a/rust/datafusion/src/execution/relation.rs b/rust/datafusion/src/execution/relation.rs
index ec6276c..98a0b4a 100644
--- a/rust/datafusion/src/execution/relation.rs
+++ b/rust/datafusion/src/execution/relation.rs
@@ -25,7 +25,7 @@ use arrow::datatypes::Schema;
 use arrow::record_batch::RecordBatch;
 
 use crate::datasource::RecordBatchIterator;
-use crate::execution::error::Result;
+use crate::error::Result;
 
 /// trait for all relations (a relation is essentially just an iterator over batches
 /// of data, with a known schema)
diff --git a/rust/datafusion/src/lib.rs b/rust/datafusion/src/lib.rs
index 63f4ab7..0cce228 100644
--- a/rust/datafusion/src/lib.rs
+++ b/rust/datafusion/src/lib.rs
@@ -25,6 +25,7 @@ extern crate serde_json;
 extern crate sqlparser;
 
 pub mod datasource;
+pub mod error;
 pub mod execution;
 pub mod logicalplan;
 pub mod optimizer;
diff --git a/rust/datafusion/src/sql/planner.rs b/rust/datafusion/src/sql/planner.rs
index 934ba2b..45e2f8e 100644
--- a/rust/datafusion/src/sql/planner.rs
+++ b/rust/datafusion/src/sql/planner.rs
@@ -20,7 +20,7 @@
 use std::string::String;
 use std::sync::Arc;
 
-use crate::execution::error::*;
+use crate::error::*;
 use crate::logicalplan::*;
 
 use arrow::datatypes::*;