Skip to content

Commit

Permalink
document truncate_min_value too
Browse files Browse the repository at this point in the history
  • Loading branch information
etseidl committed Dec 16, 2024
1 parent f251b00 commit e7d0af8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions parquet/src/column/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,16 @@ impl<'a, E: ColumnValueEncoder> GenericColumnWriter<'a, E> {
|| self.get_descriptor().converted_type() == ConvertedType::UTF8
}

/// Truncates a binary statistic to at most `truncation_length` bytes.
///
/// If truncation is not possible, returns `data`.
///
/// The `bool` in the returned tuple indicates whether truncation occurred or not.
///
/// UTF-8 Note:
/// If the column type indicates UTF-8, and `data` contains valid UTF-8, then the result will
/// also remain valid UTF-8, but may be less tnan `truncation_length` bytes to avoid splitting
/// on non-character boundaries.
fn truncate_min_value(&self, truncation_length: Option<usize>, data: &[u8]) -> (Vec<u8>, bool) {
truncation_length
.filter(|l| data.len() > *l)
Expand Down

0 comments on commit e7d0af8

Please sign in to comment.