Skip to content

Commit a886995

Browse files
committed
add encodings test
1 parent b430682 commit a886995

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

parquet/src/basic.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,4 +2461,33 @@ mod tests {
24612461
assert_eq!(EdgeInterpolationAlgorithm::ANDOYER.to_string(), "ANDOYER");
24622462
assert_eq!(EdgeInterpolationAlgorithm::KARNEY.to_string(), "KARNEY");
24632463
}
2464+
2465+
fn encodings_roundtrip(encodings: &mut [Encoding]) {
2466+
encodings.sort();
2467+
let mask = encodings_to_mask(encodings.iter());
2468+
assert_eq!(mask_to_encodings_vec(mask), encodings.to_vec());
2469+
}
2470+
2471+
#[test]
2472+
fn test_encoding_roundtrip() {
2473+
encodings_roundtrip(&mut [
2474+
Encoding::RLE,
2475+
Encoding::PLAIN,
2476+
Encoding::DELTA_BINARY_PACKED,
2477+
]);
2478+
encodings_roundtrip(&mut [Encoding::RLE_DICTIONARY, Encoding::PLAIN_DICTIONARY]);
2479+
encodings_roundtrip(&mut []);
2480+
let mut encodings = [
2481+
Encoding::PLAIN,
2482+
Encoding::BIT_PACKED,
2483+
Encoding::RLE,
2484+
Encoding::DELTA_BINARY_PACKED,
2485+
Encoding::DELTA_BYTE_ARRAY,
2486+
Encoding::DELTA_LENGTH_BYTE_ARRAY,
2487+
Encoding::PLAIN_DICTIONARY,
2488+
Encoding::RLE_DICTIONARY,
2489+
Encoding::BYTE_STREAM_SPLIT,
2490+
];
2491+
encodings_roundtrip(&mut encodings);
2492+
}
24642493
}

0 commit comments

Comments
 (0)