-
Notifications
You must be signed in to change notification settings - Fork 29
Support deserializing dictionary encoded arrays with null values #308
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,21 @@ mod construction { | |
| values: Box::new(to_array(DataType::Utf8, true, [None::<&str>, None])), | ||
| }); | ||
|
|
||
| assert!(ArrayDeserializer::new(String::from("$"), None, array.as_view()).is_err()); | ||
| let deserializer = | ||
| ArrayDeserializer::new(String::from("$"), None, array.as_view()).unwrap(); | ||
|
|
||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(0)).unwrap(), | ||
| None | ||
| ); | ||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(1)).unwrap(), | ||
| None | ||
| ); | ||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(2)).unwrap(), | ||
| None | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -196,11 +210,25 @@ mod construction { | |
| )), | ||
| }); | ||
|
|
||
| assert!(ArrayDeserializer::new(String::from("$"), None, array.as_view()).is_err()); | ||
| let deserializer = | ||
| ArrayDeserializer::new(String::from("$"), None, array.as_view()).unwrap(); | ||
|
|
||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(0)).unwrap(), | ||
| None | ||
| ); | ||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(1)).unwrap(), | ||
| None | ||
| ); | ||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(2)).unwrap(), | ||
| Some(String::from("foo")), | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn some_null_values_v2() { | ||
| fn some_null_values_out_of_range() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this test is really required anymore. It seems to be testing that if the dictionary contains a null but isn't used, it still errors out.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. Not sure what I was thinking here. I would probably remove the test. |
||
| let array = Array::Dictionary(DictionaryArray { | ||
| keys: Box::new(to_array(DataType::Int8, false, [1, 1, 0])), | ||
| values: Box::new(to_array( | ||
|
|
@@ -224,6 +252,14 @@ mod construction { | |
| )), | ||
| }); | ||
|
|
||
| assert!(ArrayDeserializer::new(String::from("$"), None, array.as_view()).is_err()); | ||
| let deserializer = | ||
| ArrayDeserializer::new(String::from("$"), None, array.as_view()).unwrap(); | ||
|
|
||
| for i in 0..3 { | ||
| assert_eq!( | ||
| Option::<String>::deserialize(deserializer.at(i)).unwrap(), | ||
| Some(String::from("1")), | ||
| ); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.