From d8429319e9bc8e81ae7e1378139ec0bf2083cb32 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 13 May 2022 14:21:54 -0400 Subject: [PATCH 1/3] Fix size_of_scalar test --- datafusion/core/src/scalar.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/core/src/scalar.rs b/datafusion/core/src/scalar.rs index 774b8ebf86dc6..05a463c994756 100644 --- a/datafusion/core/src/scalar.rs +++ b/datafusion/core/src/scalar.rs @@ -377,7 +377,7 @@ mod tests { #[cfg(target_arch = "aarch64")] assert_eq!(std::mem::size_of::(), 64); - #[cfg(target_arch = "amd64")] + #[cfg(not(target_arch = "aarch64"))] assert_eq!(std::mem::size_of::(), 48); } From 02ebb58e290f5c5becfe7bfa9619cae17a4d7ee0 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 13 May 2022 15:02:41 -0400 Subject: [PATCH 2/3] add comments --- datafusion/core/src/scalar.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datafusion/core/src/scalar.rs b/datafusion/core/src/scalar.rs index 05a463c994756..8b13e4eddc8f6 100644 --- a/datafusion/core/src/scalar.rs +++ b/datafusion/core/src/scalar.rs @@ -374,6 +374,10 @@ mod tests { // Since ScalarValues are used in a non trivial number of places, // making it larger means significant more memory consumption // per distinct value. + // + // The alignment requirements differ across architectures and + // thus the size of the enum appears to as as well + #[cfg(target_arch = "aarch64")] assert_eq!(std::mem::size_of::(), 64); From 10f36ccf2f7b4f623d8167c669712e7a38987b18 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 16 May 2022 07:19:10 -0400 Subject: [PATCH 3/3] Update tests --- datafusion/core/src/scalar.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/datafusion/core/src/scalar.rs b/datafusion/core/src/scalar.rs index 8b13e4eddc8f6..ea8fe7ac80771 100644 --- a/datafusion/core/src/scalar.rs +++ b/datafusion/core/src/scalar.rs @@ -377,12 +377,13 @@ mod tests { // // The alignment requirements differ across architectures and // thus the size of the enum appears to as as well - - #[cfg(target_arch = "aarch64")] - assert_eq!(std::mem::size_of::(), 64); - #[cfg(not(target_arch = "aarch64"))] - assert_eq!(std::mem::size_of::(), 48); + let expected = match cfg!(target_arch = "aarch64") { + true => 64, + false => 48, + }; + + assert_eq!(std::mem::size_of::(), expected); } #[test]