DarkWanderer commented on code in PR #10420:
URL: https://github.com/apache/arrow-rs/pull/10420#discussion_r4049632208
##########
parquet/src/arrow/async_reader/mod.rs:
##########
@@ -1126,6 +1156,123 @@ mod tests {
);
}
+ #[tokio::test]
+ async fn test_get_row_group_column_dictionary() {
+ let schema = Arc::new(Schema::new(vec![Field::new("s", DataType::Utf8,
false)]));
+ let values: Vec<&str> = ["alpha", "beta", "gamma"]
+ .iter()
+ .copied()
+ .cycle()
+ .take(30)
+ .collect();
+ let array: ArrayRef = Arc::new(StringArray::from(values));
+ let batch = RecordBatch::try_new(schema.clone(), vec![array]).unwrap();
+
+ let props = WriterProperties::builder()
+ .set_dictionary_enabled(true)
+ .build();
+ let mut buf = Vec::new();
+ {
+ let mut writer = ArrowWriter::try_new(&mut buf, schema,
Some(props)).unwrap();
+ writer.write(&batch).unwrap();
+ writer.close().unwrap();
+ }
+ let data = Bytes::from(buf);
+
+ let async_reader = TestReader::new(data);
+ let mut builder = ParquetRecordBatchStreamBuilder::new(async_reader)
+ .await
+ .unwrap();
+
+ let dictionary = builder
+ .get_row_group_column_dictionary(0, 0)
+ .await
+ .unwrap()
+ .unwrap();
+ let dictionary =
dictionary.as_any().downcast_ref::<StringArray>().unwrap();
+ let dictionary_values: Vec<&str> = dictionary.iter().map(|v|
v.unwrap()).collect();
+ assert_eq!(dictionary_values, vec!["alpha", "beta", "gamma"]);
+ }
+
+ #[tokio::test]
+ async fn test_dictionary_selects_row_groups_without_reading_skipped_data()
{
Review Comment:
Done - added comments, LMK if enough
--
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]