Skip to content

Commit

Permalink
fix: decode Fixed-Size-List Parquet dict page
Browse files Browse the repository at this point in the history
Fixes #17929.
  • Loading branch information
coastalwhite committed Jul 30, 2024
1 parent a7dc15f commit 1f18aa1
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ impl Decoder for BinaryDecoder {
}

fn gather_one(&self, target: &mut Self::Target, value: &'a [u8]) -> ParquetResult<()> {
// We make the null value length 0, which allows us to do this.
if value.len() == 0 {
target.resize(target.len() + self.size, 0);
return Ok(());
}

target.extend_from_slice(value);
Ok(())
}
Expand All @@ -234,9 +240,17 @@ impl Decoder for BinaryDecoder {
value: &'a [u8],
n: usize,
) -> ParquetResult<()> {
// We make the null value length 0, which allows us to do this.
if value.len() == 0 {
target.resize(target.len() + n * self.size, 0);
return Ok(());
}

debug_assert_eq!(value.len(), self.size);
for _ in 0..n {
target.extend(value);
}

Ok(())
}
}
Expand All @@ -246,7 +260,10 @@ impl Decoder for BinaryDecoder {
size: self.size,
};

let null_value = &dict[..self.size];
// @NOTE:
// This is a special case in our gatherer. If the length of the value is 0, then we just
// resize with the appropriate size. Important is that this also works for FSL with size=0.
let null_value = &[];

match page_validity {
None => {
Expand Down

0 comments on commit 1f18aa1

Please sign in to comment.