You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/06/19 10:50:56 UTC

[arrow-datafusion] branch main updated: fix: correct the error type (#6712)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new a3035b510f fix: correct the error type (#6712)
a3035b510f is described below

commit a3035b510f22867a91a81b05ccf7d0025dc40062
Author: jakevin <ja...@gmail.com>
AuthorDate: Mon Jun 19 18:50:50 2023 +0800

    fix: correct the error type (#6712)
---
 datafusion/core/src/execution/context.rs | 2 +-
 datafusion/sql/src/expr/arrow_cast.rs    | 2 +-
 datafusion/sql/src/expr/grouping_set.rs  | 4 ++--
 datafusion/sql/src/expr/identifier.rs    | 2 +-
 datafusion/sql/src/expr/mod.rs           | 4 ++--
 datafusion/sql/src/expr/unary_op.rs      | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rs
index f9f4a11d10..3fa30af0ce 100644
--- a/datafusion/core/src/execution/context.rs
+++ b/datafusion/core/src/execution/context.rs
@@ -2135,7 +2135,7 @@ mod tests {
 
         assert_eq!(
             err.to_string(),
-            "Execution error: variable [\"@\"] has no type information"
+            "Error during planning: variable [\"@\"] has no type information"
         );
         Ok(())
     }
diff --git a/datafusion/sql/src/expr/arrow_cast.rs b/datafusion/sql/src/expr/arrow_cast.rs
index 607a9fb432..91a42f4736 100644
--- a/datafusion/sql/src/expr/arrow_cast.rs
+++ b/datafusion/sql/src/expr/arrow_cast.rs
@@ -59,7 +59,7 @@ pub fn create_arrow_cast(mut args: Vec<Expr>, schema: &DFSchema) -> Result<Expr>
     let arg1 = args.pop().unwrap();
     let arg0 = args.pop().unwrap();
 
-    // arg1 must be a stirng
+    // arg1 must be a string
     let data_type_string = if let Expr::Literal(ScalarValue::Utf8(Some(v))) = arg1 {
         v
     } else {
diff --git a/datafusion/sql/src/expr/grouping_set.rs b/datafusion/sql/src/expr/grouping_set.rs
index c5a0b6da7d..34dfac158a 100644
--- a/datafusion/sql/src/expr/grouping_set.rs
+++ b/datafusion/sql/src/expr/grouping_set.rs
@@ -48,7 +48,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             .into_iter()
             .map(|v| {
                 if v.len() != 1 {
-                    Err(DataFusionError::Internal(
+                    Err(DataFusionError::Plan(
                         "Tuple expressions are not supported for Rollup expressions"
                             .to_string(),
                     ))
@@ -70,7 +70,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             .into_iter()
             .map(|v| {
                 if v.len() != 1 {
-                    Err(DataFusionError::Internal(
+                    Err(DataFusionError::Plan(
                         "Tuple expressions not are supported for Cube expressions"
                             .to_string(),
                     ))
diff --git a/datafusion/sql/src/expr/identifier.rs b/datafusion/sql/src/expr/identifier.rs
index fdf3d0f20b..c18587d834 100644
--- a/datafusion/sql/src/expr/identifier.rs
+++ b/datafusion/sql/src/expr/identifier.rs
@@ -36,7 +36,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 .schema_provider
                 .get_variable_type(&var_names)
                 .ok_or_else(|| {
-                    DataFusionError::Execution(format!(
+                    DataFusionError::Plan(format!(
                         "variable {var_names:?} has no type information"
                     ))
                 })?;
diff --git a/datafusion/sql/src/expr/mod.rs b/datafusion/sql/src/expr/mod.rs
index 6099759a3c..4155484cea 100644
--- a/datafusion/sql/src/expr/mod.rs
+++ b/datafusion/sql/src/expr/mod.rs
@@ -511,7 +511,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 )?)),
                 order_by,
             ))),
-            _ => Err(DataFusionError::Internal(
+            _ => Err(DataFusionError::Plan(
                 "AggregateExpressionWithFilter expression was not an AggregateFunction"
                     .to_string(),
             )),
@@ -563,7 +563,7 @@ fn plan_key(key: SQLExpr) -> Result<ScalarValue> {
         }
         _ => {
             return Err(DataFusionError::SQL(ParserError(format!(
-                "Unsuported index key expression: {key:?}"
+                "Unsupported index key expression: {key:?}"
             ))));
         }
     };
diff --git a/datafusion/sql/src/expr/unary_op.rs b/datafusion/sql/src/expr/unary_op.rs
index d24fc71540..dc7b5abd45 100644
--- a/datafusion/sql/src/expr/unary_op.rs
+++ b/datafusion/sql/src/expr/unary_op.rs
@@ -44,7 +44,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                         Err(_) => Ok(lit(-n
                             .parse::<f64>()
                             .map_err(|_e| {
-                                DataFusionError::Internal(format!(
+                                DataFusionError::Plan(format!(
                                     "negative operator can be only applied to integer and float operands, got: {n}"))
                             })?)),
                     },