tustvold commented on code in PR #1746:
URL: https://github.com/apache/arrow-rs/pull/1746#discussion_r883023496
##########
parquet/src/arrow/levels.rs:
##########
@@ -1331,50 +662,27 @@ mod tests {
let batch = RecordBatch::try_new(Arc::new(schema),
vec![values]).unwrap();
- let expected_batch_level = LevelInfo {
- definition: vec![0; 2],
- repetition: None,
- array_offsets: (0..=2).collect(),
- array_mask: vec![true, true],
- max_definition: 0,
- level_type: LevelType::Root,
- offset: 2,
- length: 2,
- };
-
- let batch_level = LevelInfo::new(2, 2);
- assert_eq!(&batch_level, &expected_batch_level);
-
// calculate the list's level
let mut levels = vec![];
batch
.columns()
.iter()
.zip(batch.schema().fields())
.for_each(|(array, field)| {
- let mut array_levels =
batch_level.calculate_array_levels(array, field);
+ let mut array_levels = calculate_array_levels(array,
field).unwrap();
levels.append(&mut array_levels);
});
assert_eq!(levels.len(), 1);
let list_level = levels.get(0).unwrap();
let expected_level = LevelInfo {
- definition: vec![0, 3, 3, 3],
- repetition: Some(vec![0, 0, 1, 1]),
- array_offsets: vec![3, 3, 6],
- array_mask: vec![false, true, true, true],
- max_definition: 3,
- level_type: LevelType::Primitive(true),
- offset: 3,
- length: 3,
+ def_levels: Some(vec![2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2]),
Review Comment:
The original test was creating LevelInfo with a length and offset of 2. So
it was actually only translating
```
[[], [4, 5, 6]]
```
Instead of the full array which is
```
[[1], [2, 3], [], [4, 5, 6], [7, 8, 9, 10]]
```
The definition levels change because I changed the nullability, I'm not
honestly sure why I did this...
--
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]