Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added simple test for patched base encoding based on ORC v2 spec
  • Loading branch information
Baptiste Mehat committed Dec 11, 2025
commit 06159e63265e12449341a779f91eed3c260a4802
17 changes: 17 additions & 0 deletions src/encoding/integer/rle_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ mod tests {

use std::io::Cursor;

use arrow::datatypes::ToByteSlice;
use proptest::prelude::*;

use crate::encoding::{
Expand All @@ -554,6 +555,22 @@ mod tests {
assert_eq!(actual, expected);
}

#[test]
fn writer_test_patched_base() {
// Data extracted from ORC v2 Specification Draft
let mut literals = [
2030, 2000, 2020, 1000000, 2040, 2050, 2060, 2070, 2080, 2090, 2100, 2110, 2120, 2130,
2140, 2150, 2160, 2170, 2180, 2190,
];
let expected = [
0x8e, 0x13, 0x2b, 0x21, 0x07, 0xd0, 0x1e, 0x00, 0x14, 0x70, 0x28, 0x32, 0x3c, 0x46,
0x50, 0x5a, 0x64, 0x6e, 0x78, 0x82, 0x8c, 0x96, 0xa0, 0xaa, 0xb4, 0xbe, 0xfc, 0xe8,
];
let mut writer = RleV2Encoder::<i64, UnsignedEncoding>::new();
determine_variable_run_encoding::<i64, UnsignedEncoding>(&mut writer.data, &mut literals);
assert_eq!(writer.data.to_byte_slice(), expected);
}

#[test]
fn reader_test() {
let data = [2, 1, 64, 5, 80, 1, 1];
Expand Down