Skip to content

Commit c0e7987

Browse files
alambDandandan
authored andcommitted
Minor: Do what clippy says and clean up some code (apache#4007)
1 parent 6356a21 commit c0e7987

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

datafusion/core/tests/sql/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::*;
2020
#[tokio::test]
2121
async fn csv_query_error() -> Result<()> {
2222
// sin(utf8) should error
23-
let ctx = create_ctx()?;
23+
let ctx = create_ctx();
2424
register_aggregate_csv(&ctx).await?;
2525
let sql = "SELECT sin(c1) FROM aggregate_test_100";
2626
let plan = ctx.create_logical_plan(sql);
@@ -31,7 +31,7 @@ async fn csv_query_error() -> Result<()> {
3131
#[tokio::test]
3232
async fn test_cast_expressions_error() -> Result<()> {
3333
// sin(utf8) should error
34-
let ctx = create_ctx()?;
34+
let ctx = create_ctx();
3535
register_aggregate_csv(&ctx).await?;
3636
let sql = "SELECT CAST(c1 AS INT) FROM aggregate_test_100";
3737
let plan = ctx.create_logical_plan(sql).unwrap();

datafusion/core/tests/sql/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ async fn test_cast_expressions() -> Result<()> {
11701170

11711171
#[tokio::test]
11721172
async fn test_random_expression() -> Result<()> {
1173-
let ctx = create_ctx()?;
1173+
let ctx = create_ctx();
11741174
let sql = "SELECT random() r1";
11751175
let actual = execute(&ctx, sql).await;
11761176
let r1 = actual[0][0].parse::<f64>().unwrap();
@@ -1480,7 +1480,7 @@ async fn csv_count_star() -> Result<()> {
14801480

14811481
#[tokio::test]
14821482
async fn csv_query_avg_sqrt() -> Result<()> {
1483-
let ctx = create_ctx()?;
1483+
let ctx = create_ctx();
14841484
register_aggregate_csv(&ctx).await?;
14851485
let sql = "SELECT avg(custom_sqrt(c12)) FROM aggregate_test_100";
14861486
let mut actual = execute(&ctx, sql).await;
@@ -1493,7 +1493,7 @@ async fn csv_query_avg_sqrt() -> Result<()> {
14931493
// this query used to deadlock due to the call udf(udf())
14941494
#[tokio::test]
14951495
async fn csv_query_sqrt_sqrt() -> Result<()> {
1496-
let ctx = create_ctx()?;
1496+
let ctx = create_ctx();
14971497
register_aggregate_csv(&ctx).await?;
14981498
let sql = "SELECT sqrt(sqrt(c12)) FROM aggregate_test_100 LIMIT 1";
14991499
let actual = execute(&ctx, sql).await;

datafusion/core/tests/sql/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::*;
1919

2020
#[tokio::test]
2121
async fn sqrt_f32_vs_f64() -> Result<()> {
22-
let ctx = create_ctx()?;
22+
let ctx = create_ctx();
2323
register_aggregate_csv(&ctx).await?;
2424
// sqrt(f32)'s plan passes
2525
let sql = "SELECT avg(sqrt(c11)) FROM aggregate_test_100";

datafusion/core/tests/sql/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ where
134134
});
135135
}
136136

137-
#[allow(clippy::unnecessary_wraps)]
138-
fn create_ctx() -> Result<SessionContext> {
137+
fn create_ctx() -> SessionContext {
139138
let mut ctx = SessionContext::new();
140139

141140
// register a custom UDF
@@ -147,7 +146,7 @@ fn create_ctx() -> Result<SessionContext> {
147146
Arc::new(custom_sqrt),
148147
));
149148

150-
Ok(ctx)
149+
ctx
151150
}
152151

153152
fn custom_sqrt(args: &[ColumnarValue]) -> Result<ColumnarValue> {

datafusion/core/tests/sql/udf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use datafusion_expr::{create_udaf, LogicalPlanBuilder};
2828
/// physical plan have the same schema.
2929
#[tokio::test]
3030
async fn csv_query_custom_udf_with_cast() -> Result<()> {
31-
let ctx = create_ctx()?;
31+
let ctx = create_ctx();
3232
register_aggregate_csv(&ctx).await?;
3333
let sql = "SELECT avg(custom_sqrt(c11)) FROM aggregate_test_100";
3434
let actual = execute(&ctx, sql).await;

0 commit comments

Comments
 (0)