-
Notifications
You must be signed in to change notification settings - Fork 421
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
add boolean, date, timestamp & binary partition types #1180
Conversation
Signed-off-by: Marijn Valk <marijncv@hotmail.com>
Signed-off-by: Marijn Valk <marijncv@hotmail.com>
Signed-off-by: Marijn Valk <marijncv@hotmail.com>
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.
Thanks for working on this @marijncv!
Just one comment, but otherwise looks great.
Co-authored-by: Will Jones <willjones127@gmail.com>
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.
Thanks @marijncv
LGTM 👍
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 for the delay. I meant my earlier comment about not needing more than 1 value in the test to apply to all the test cases, not just the one I had made a suggestion on.
Added a few other comments to make the test cases a little more compact.
rust/src/writer/utils.rs
Outdated
( | ||
Arc::new(Int8Array::from(vec![Some(1), Some(2)])), | ||
Some(String::from("1")), | ||
), | ||
( | ||
Arc::new(Int16Array::from(vec![Some(1), Some(2)])), | ||
Some(String::from("1")), | ||
), | ||
( | ||
Arc::new(Int32Array::from(vec![Some(1), Some(2)])), | ||
Some(String::from("1")), | ||
), |
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.
This can be applied to all the test cases: You shouldn't need the Some
inside the array.
( | |
Arc::new(Int8Array::from(vec![Some(1), Some(2)])), | |
Some(String::from("1")), | |
), | |
( | |
Arc::new(Int16Array::from(vec![Some(1), Some(2)])), | |
Some(String::from("1")), | |
), | |
( | |
Arc::new(Int32Array::from(vec![Some(1), Some(2)])), | |
Some(String::from("1")), | |
), | |
(Arc::new(Int8Array::from(vec![1])), Some("1")), | |
(Arc::new(Int16Array::from(vec![1])), Some("1")), | |
(Arc::new(Int32Array::from(vec![1])), Some("1")), |
rust/src/writer/utils.rs
Outdated
|
||
#[test] | ||
fn test_stringified_partition_value() { | ||
let reference_pairs: Vec<(Arc<dyn Array>, Option<String>)> = vec![ |
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 can use &str
instead to avoid needing String::from()
in every test case.
let reference_pairs: Vec<(Arc<dyn Array>, Option<String>)> = vec![ | |
let reference_pairs: Vec<(Arc<dyn Array>, Option<&str>)> = vec![ |
rust/src/writer/utils.rs
Outdated
), | ||
]; | ||
for (vals, result) in reference_pairs { | ||
assert_eq!(stringified_partition_value(&vals).unwrap(), result) |
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 can use as_deref()
to turn Option<String>
into Option<&str>
:
assert_eq!(stringified_partition_value(&vals).unwrap(), result) | |
assert_eq!( | |
stringified_partition_value(&vals).unwrap().as_deref(), | |
result | |
) |
rust/src/writer/utils.rs
Outdated
( | ||
Arc::new(StringArray::from(vec![ | ||
Some(String::from("1")), | ||
Some(String::from("2")), | ||
])), | ||
Some(String::from("1")), | ||
), |
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.
The StringArray::from
implementation can take a &str
:
( | |
Arc::new(StringArray::from(vec![ | |
Some(String::from("1")), | |
Some(String::from("2")), | |
])), | |
Some(String::from("1")), | |
), | |
(Arc::new(StringArray::from(vec!["1"])), Some("1")), |
Signed-off-by: Marijn Valk <marijncv@hotmail.com>
Signed-off-by: Marijn Valk <marijncv@hotmail.com>
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.
LGTM!
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.
Great! Thanks @marijncv
# Description Adds boolean, date, timestamp & binary partition value types # Related Issue(s) closes delta-io#1170 --------- Signed-off-by: Marijn Valk <marijncv@hotmail.com> Co-authored-by: Will Jones <willjones127@gmail.com>
Description
Adds boolean, date, timestamp & binary partition value types
Related Issue(s)
closes #1170