From 19fb4a1f83bc17b12f6ac49577d5a8a0a3ae94b2 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Sat, 8 Mar 2025 18:02:32 +0000 Subject: [PATCH] fix: modify tests which compare partition values due to breakage in kernel as of delta-kernel-rs 0.7.0 a Vec will no longer be comparable if there are nulls in it, which breaks a couple of our tests which perform said check. I feel that this is likely going to cause downstream issues with users of delta-rs, in which case we will have to bring it up with the kernel developers who assert that Null(String) will never equal Null(String). Signed-off-by: R. Tyler Croy --- .../core/src/operations/convert_to_delta.rs | 20 +++++++++---------- crates/core/src/writer/json.rs | 7 +------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/crates/core/src/operations/convert_to_delta.rs b/crates/core/src/operations/convert_to_delta.rs index 8ea214fa22..f4c563fbc5 100644 --- a/crates/core/src/operations/convert_to_delta.rs +++ b/crates/core/src/operations/convert_to_delta.rs @@ -605,16 +605,16 @@ mod tests { .collect::>(); partition_values.sort_by_key(|(k, v)| (k.clone(), v.serialize())); - for it in expected_partition_values.iter().zip(partition_values.iter()) { - let (expected, found) = it; - - match (expected, found) { - // No-oipping the comparison of null. delta-kernel-rs introduces a regression where - // 0.7.0 cannot perform equivalency of typed null Scalars. - (Scalar::Null(_), Scalar::Null(_)) => {}, - _others => { - assert_eq!(expected, found); - }, + for (position, expected) in expected_partition_values.iter().enumerate() { + let (key, value) = expected; + let (found_key, found_value) = partition_values[position].clone(); + assert_eq!(key, &found_key); + + match (value, found_value) { + // no-op the null comparison due to a breaking change in delta-kernel-rs 0.7.0 + // which changes null comparables + (Scalar::Null(_), Scalar::Null(_)) => {} + (v, fv) => assert_eq!(v, &fv), } } } diff --git a/crates/core/src/writer/json.rs b/crates/core/src/writer/json.rs index 81bcc9eab6..a4837eeb6d 100644 --- a/crates/core/src/writer/json.rs +++ b/crates/core/src/writer/json.rs @@ -542,18 +542,13 @@ mod tests { assert_eq!( extract_partition_values( - &[ - String::from("col1"), - String::from("col2"), - String::from("col3") - ], + &[String::from("col1"), String::from("col2"),], &record_batch ) .unwrap(), IndexMap::from([ (String::from("col1"), Scalar::Integer(1)), (String::from("col2"), Scalar::Integer(2)), - (String::from("col3"), Scalar::Null(DataType::INTEGER)), ]) ); assert_eq!(