-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix size_of_scalar test #2531
Fix size_of_scalar test #2531
Conversation
datafusion/core/src/scalar.rs
Outdated
@@ -377,7 +377,7 @@ mod tests { | |||
#[cfg(target_arch = "aarch64")] | |||
assert_eq!(std::mem::size_of::<ScalarValue>(), 64); | |||
|
|||
#[cfg(target_arch = "amd64")] | |||
#[cfg(not(target_arch = "aarch64"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this formulation as it ensures that one of these assert_eq!
calls will always be invoked, regardless of architecture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also write something like
let expected = match cfg!(target_arch == "aarch64") {
true => 64,
false => 48,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let expected = match cfg!(target_arch == "aarch64") {
true => 64,
false => 48,
};
resulted in
error: expected 1 cfg-pattern
--> datafusion/core/src/scalar.rs:380:30
|
380 | let expected = match cfg!(target_arch == "aarch64") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `cfg` (in Nightly builds, run with -Z macro-backtrace for more info)
for me locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, try removing the double equals...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment about why there is the architectural discrepancy might be nice
datafusion/core/src/scalar.rs
Outdated
@@ -377,7 +377,7 @@ mod tests { | |||
#[cfg(target_arch = "aarch64")] | |||
assert_eq!(std::mem::size_of::<ScalarValue>(), 64); | |||
|
|||
#[cfg(target_arch = "amd64")] | |||
#[cfg(not(target_arch = "aarch64"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also write something like
let expected = match cfg!(target_arch == "aarch64") {
true => 64,
false => 48,
};
* Fix size_of_scalar test * add comments * Update tests
Which issue does this PR close?
N/A
Rationale for this change
This test is important. It verifies that the memory use of code like GroupByHash is not changed. Quoting:
It turns out that the way the
cfgs
were setup the test never was invoked.The change seems to have come in via #1455 from @maxburke
I found this while reviewing #2523
What changes are included in this PR?
Fix test so it is always invoked
Are there any user-facing changes?
no