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

agrove 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 f4d70ac3e Minor: Do what clippy says and clean up some code (#4007)
f4d70ac3e is described below

commit f4d70ac3e1c4298f9ea5ebb12855a95d60d2b737
Author: Andrew Lamb <[email protected]>
AuthorDate: Sun Oct 30 12:42:52 2022 -0400

    Minor: Do what clippy says and clean up some code (#4007)
---
 datafusion/core/tests/sql/errors.rs    | 4 ++--
 datafusion/core/tests/sql/expr.rs      | 6 +++---
 datafusion/core/tests/sql/functions.rs | 2 +-
 datafusion/core/tests/sql/mod.rs       | 5 ++---
 datafusion/core/tests/sql/udf.rs       | 2 +-
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/datafusion/core/tests/sql/errors.rs 
b/datafusion/core/tests/sql/errors.rs
index f1cbdd7d8..15759b913 100644
--- a/datafusion/core/tests/sql/errors.rs
+++ b/datafusion/core/tests/sql/errors.rs
@@ -20,7 +20,7 @@ use super::*;
 #[tokio::test]
 async fn csv_query_error() -> Result<()> {
     // sin(utf8) should error
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     let sql = "SELECT sin(c1) FROM aggregate_test_100";
     let plan = ctx.create_logical_plan(sql);
@@ -31,7 +31,7 @@ async fn csv_query_error() -> Result<()> {
 #[tokio::test]
 async fn test_cast_expressions_error() -> Result<()> {
     // sin(utf8) should error
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     let sql = "SELECT CAST(c1 AS INT) FROM aggregate_test_100";
     let plan = ctx.create_logical_plan(sql).unwrap();
diff --git a/datafusion/core/tests/sql/expr.rs 
b/datafusion/core/tests/sql/expr.rs
index bb9f69dff..b7e685592 100644
--- a/datafusion/core/tests/sql/expr.rs
+++ b/datafusion/core/tests/sql/expr.rs
@@ -1170,7 +1170,7 @@ async fn test_cast_expressions() -> Result<()> {
 
 #[tokio::test]
 async fn test_random_expression() -> Result<()> {
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     let sql = "SELECT random() r1";
     let actual = execute(&ctx, sql).await;
     let r1 = actual[0][0].parse::<f64>().unwrap();
@@ -1480,7 +1480,7 @@ async fn csv_count_star() -> Result<()> {
 
 #[tokio::test]
 async fn csv_query_avg_sqrt() -> Result<()> {
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     let sql = "SELECT avg(custom_sqrt(c12)) FROM aggregate_test_100";
     let mut actual = execute(&ctx, sql).await;
@@ -1493,7 +1493,7 @@ async fn csv_query_avg_sqrt() -> Result<()> {
 // this query used to deadlock due to the call udf(udf())
 #[tokio::test]
 async fn csv_query_sqrt_sqrt() -> Result<()> {
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     let sql = "SELECT sqrt(sqrt(c12)) FROM aggregate_test_100 LIMIT 1";
     let actual = execute(&ctx, sql).await;
diff --git a/datafusion/core/tests/sql/functions.rs 
b/datafusion/core/tests/sql/functions.rs
index 9e16f920e..2b47d893a 100644
--- a/datafusion/core/tests/sql/functions.rs
+++ b/datafusion/core/tests/sql/functions.rs
@@ -19,7 +19,7 @@ use super::*;
 
 #[tokio::test]
 async fn sqrt_f32_vs_f64() -> Result<()> {
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     // sqrt(f32)'s plan passes
     let sql = "SELECT avg(sqrt(c11)) FROM aggregate_test_100";
diff --git a/datafusion/core/tests/sql/mod.rs b/datafusion/core/tests/sql/mod.rs
index 23ea2a2dd..ede9fafa7 100644
--- a/datafusion/core/tests/sql/mod.rs
+++ b/datafusion/core/tests/sql/mod.rs
@@ -134,8 +134,7 @@ where
         });
 }
 
-#[allow(clippy::unnecessary_wraps)]
-fn create_ctx() -> Result<SessionContext> {
+fn create_ctx() -> SessionContext {
     let mut ctx = SessionContext::new();
 
     // register a custom UDF
@@ -147,7 +146,7 @@ fn create_ctx() -> Result<SessionContext> {
         Arc::new(custom_sqrt),
     ));
 
-    Ok(ctx)
+    ctx
 }
 
 fn custom_sqrt(args: &[ColumnarValue]) -> Result<ColumnarValue> {
diff --git a/datafusion/core/tests/sql/udf.rs b/datafusion/core/tests/sql/udf.rs
index 6e3780642..679942192 100644
--- a/datafusion/core/tests/sql/udf.rs
+++ b/datafusion/core/tests/sql/udf.rs
@@ -28,7 +28,7 @@ use datafusion_expr::{create_udaf, LogicalPlanBuilder};
 /// physical plan have the same schema.
 #[tokio::test]
 async fn csv_query_custom_udf_with_cast() -> Result<()> {
-    let ctx = create_ctx()?;
+    let ctx = create_ctx();
     register_aggregate_csv(&ctx).await?;
     let sql = "SELECT avg(custom_sqrt(c11)) FROM aggregate_test_100";
     let actual = execute(&ctx, sql).await;

Reply via email to