tustvold commented on code in PR #2100:
URL: https://github.com/apache/arrow-rs/pull/2100#discussion_r923627094
##########
parquet/src/arrow/array_reader/byte_array_dictionary.rs:
##########
@@ -507,6 +519,51 @@ mod tests {
}
}
+ #[test]
+ fn test_dictionary_skip_fallback() {
+ let data_type = utf8_dictionary();
+ let data = vec!["hello", "world", "a", "b"];
+
+ let (pages, encoded_dictionary) =
byte_array_all_encodings(data.clone());
+ let num_encodings = pages.len();
+
+ let column_desc = utf8_column();
+ let mut decoder = DictionaryDecoder::<i32, i32>::new(&column_desc);
+
+ decoder
+ .set_dict(encoded_dictionary, 4, Encoding::RLE_DICTIONARY, false)
+ .unwrap();
+
+ // Read all pages into single buffer
+ let mut output = DictionaryBuffer::<i32, i32>::default();
+
+ for (encoding, page) in pages {
+ decoder.set_data(encoding, page, 4, Some(4)).unwrap();
+ decoder.skip_values(2).expect("skipping two values");
+ assert_eq!(decoder.read(&mut output, 0..1024).unwrap(), 2);
+ }
+ let array = output.into_array(None, &data_type).unwrap();
+ assert_eq!(array.data_type(), &data_type);
+
+ let array = cast(&array, &ArrowType::Utf8).unwrap();
+ let strings = array.as_any().downcast_ref::<StringArray>().unwrap();
+ assert_eq!(strings.len(), (data.len() - 2) * num_encodings);
+
+ // Should have a copy of `data` for each encoding
+ for i in 0..num_encodings {
+ assert_eq!(
+ &strings
+ .iter()
+ .skip(i * (data.len() - 2))
Review Comment:
Actually nvm - remembered how this test worked
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]