Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
fixed MSB selector
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrach committed Dec 14, 2021
1 parent fdb8c68 commit b5c4184
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parquet_integration/write_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def case_basic_nullable(size=1):


def case_basic_required(size=1):
int64 = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]
int64 = [-256, -1, 0, 1, 2, 3, 4, 5, 6, 7]
uint32 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
float64 = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
string = ["Hello", "bbb", "aa", "", "bbb", "abc", "bbb", "bbb", "def", "aaa"]
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ fn page_iter_to_array<I: FallibleStreamingIterator<Item = DataPage, Error = Parq
.map(|v| {
v.and_then(|v1| {
// Pad with the value of the MSB to correctly handle (two's complement) negative integers.
let msb_set = v1.last().unwrap_or(&0) >> 7 == 1;
let msb_set = v1.first().unwrap_or(&0) >> 7 == 1;
let padding = if msb_set {
&ones_padding
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/it/io/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ pub fn pyarrow_nullable_statistics(column: usize) -> Option<Box<dyn Statistics>>
// these values match the values in `integration`
pub fn pyarrow_required(column: usize) -> Box<dyn Array> {
let i64_values = &[
Some(-256),
Some(-1),
Some(0),
Some(1),
Expand All @@ -408,7 +409,6 @@ pub fn pyarrow_required(column: usize) -> Box<dyn Array> {
Some(5),
Some(6),
Some(7),
Some(8),
];

match column {
Expand Down

0 comments on commit b5c4184

Please sign in to comment.