From b5ecfbcdcc6dced2bed03f33361afbd965776992 Mon Sep 17 00:00:00 2001 From: Omkar P <45419097+omkar-foss@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:42:26 +0530 Subject: [PATCH] chore: fix formatting --- crates/core/src/operations/merge/filter.rs | 89 ++++++++++++---------- crates/core/src/operations/merge/mod.rs | 24 +++--- 2 files changed, 59 insertions(+), 54 deletions(-) diff --git a/crates/core/src/operations/merge/filter.rs b/crates/core/src/operations/merge/filter.rs index 5346c1b6a9..0745c55830 100644 --- a/crates/core/src/operations/merge/filter.rs +++ b/crates/core/src/operations/merge/filter.rs @@ -675,7 +675,7 @@ mod tests { Arc::new(arrow::array::StringArray::from(vec![ "2023-07-04", "2023-07-05", - "2023-07-05" + "2023-07-05", ])), ], ) @@ -702,12 +702,10 @@ mod tests { relation: Some(target_name.clone()), name: "id".to_owned(), })) - .and( - col("modified".to_owned()) - .in_list(vec![ - lit("2023-07-05"), lit("2023-07-06"), lit("2023-07-07") - ], false), - ); + .and(col("modified".to_owned()).in_list( + vec![lit("2023-07-05"), lit("2023-07-06"), lit("2023-07-07")], + false, + )); let pred = try_construct_early_filter( join_predicate, @@ -734,11 +732,15 @@ mod tests { col(Column { relation: None, name: "modified".to_owned(), - }).in_list(vec![ - Expr::Literal(ScalarValue::Utf8(Some("2023-07-05".to_string()))), - Expr::Literal(ScalarValue::Utf8(Some("2023-07-06".to_string()))), - Expr::Literal(ScalarValue::Utf8(Some("2023-07-07".to_string()))) - ], false), + }) + .in_list( + vec![ + Expr::Literal(ScalarValue::Utf8(Some("2023-07-05".to_string()))), + Expr::Literal(ScalarValue::Utf8(Some("2023-07-06".to_string()))), + Expr::Literal(ScalarValue::Utf8(Some("2023-07-07".to_string()))), + ], + false, + ), ); assert_eq!(pred.unwrap(), filter); } @@ -760,7 +762,7 @@ mod tests { Arc::new(arrow::array::StringArray::from(vec![ "2023-07-04", "2023-07-05", - "2023-07-05" + "2023-07-05", ])), ], ) @@ -787,9 +789,8 @@ mod tests { relation: Some(target_name.clone()), name: "id".to_owned(), })) - .and( - col("modified".to_owned()) - .in_list(vec![ + .and(col("modified".to_owned()).in_list( + vec![ col(Column { relation: Some(target_name.clone()), name: "id".to_owned(), @@ -797,9 +798,10 @@ mod tests { col(Column { relation: Some(target_name.clone()), name: "modified".to_owned(), - }) - ], false), - ); + }), + ], + false, + )); let pred = try_construct_early_filter( join_predicate, @@ -826,16 +828,20 @@ mod tests { col(Column { relation: None, name: "modified".to_owned(), - }).in_list(vec![ - col(Column { - relation: Some(target_name.clone()), - name: "id".to_owned(), - }), - col(Column { - relation: Some(target_name.clone()), - name: "modified".to_owned(), - }) - ], false), + }) + .in_list( + vec![ + col(Column { + relation: Some(target_name.clone()), + name: "id".to_owned(), + }), + col(Column { + relation: Some(target_name.clone()), + name: "modified".to_owned(), + }), + ], + false, + ), ); assert_eq!(pred.unwrap(), filter); } @@ -857,7 +863,7 @@ mod tests { Arc::new(arrow::array::StringArray::from(vec![ "2023-07-04", "2023-07-05", - "2023-07-05" + "2023-07-05", ])), ], ) @@ -884,9 +890,8 @@ mod tests { relation: Some(target_name.clone()), name: "id".to_owned(), })) - .and( - ident("source.id") - .in_list(vec![ + .and(ident("source.id").in_list( + vec![ col(Column { relation: Some(target_name.clone()), name: "id".to_owned(), @@ -894,9 +899,10 @@ mod tests { col(Column { relation: Some(target_name.clone()), name: "modified".to_owned(), - }) - ], false), - ); + }), + ], + false, + )); let pred = try_construct_early_filter( join_predicate, @@ -919,8 +925,8 @@ mod tests { Expr::Literal(ScalarValue::Utf8(Some("A".to_string()))), Expr::Literal(ScalarValue::Utf8(Some("C".to_string()))), ) - .and( - ident("source.id").in_list(vec![ + .and(ident("source.id").in_list( + vec![ col(Column { relation: Some(target_name.clone()), name: "id".to_owned(), @@ -928,9 +934,10 @@ mod tests { col(Column { relation: Some(target_name.clone()), name: "modified".to_owned(), - }) - ], false), - ); + }), + ], + false, + )); assert_eq!(pred.unwrap(), filter); } } diff --git a/crates/core/src/operations/merge/mod.rs b/crates/core/src/operations/merge/mod.rs index 32b0e6b521..fbe255cdbc 100644 --- a/crates/core/src/operations/merge/mod.rs +++ b/crates/core/src/operations/merge/mod.rs @@ -1997,19 +1997,17 @@ mod tests { let (table, metrics) = DeltaOps(table) .merge( source, - col("target.id").eq(col("source.id")) - .and( - col("target.id") - .in_list(vec![ - col("source.id"), - col("source.modified"), - col("source.value") - ], false) - ) - .and( - col("target.modified") - .in_list(vec![lit("2021-02-02")], false) - ), + col("target.id") + .eq(col("source.id")) + .and(col("target.id").in_list( + vec![ + col("source.id"), + col("source.modified"), + col("source.value"), + ], + false, + )) + .and(col("target.modified").in_list(vec![lit("2021-02-02")], false)), ) .with_source_alias("source") .with_target_alias("target")