Skip to content

Commit

Permalink
add histograms to to_thrift()
Browse files Browse the repository at this point in the history
  • Loading branch information
etseidl committed Aug 1, 2024
1 parent 8691903 commit 241ee02
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions parquet/src/file/page_index/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,29 @@ impl<T: ParquetValueType> NativeIndex<T> {
.map(|x| x.null_count())
.collect::<Option<Vec<_>>>();

// Concatenate page histograms into a single Option<Vec>
let repetition_level_histograms = self
.indexes
.iter()
.map(|x| x.repetition_level_histogram().map(|v| v.values()))
.collect::<Option<Vec<&[i64]>>>()
.map(|hists| hists.concat());

let definition_level_histograms = self
.indexes
.iter()
.map(|x| x.definition_level_histogram().map(|v| v.values()))
.collect::<Option<Vec<&[i64]>>>()
.map(|hists| hists.concat());

ColumnIndex::new(
self.indexes.iter().map(|x| x.min().is_none()).collect(),
min_values,
max_values,
self.boundary_order,
null_counts,
None,
None,
repetition_level_histograms,
definition_level_histograms,
)
}
}
Expand Down

0 comments on commit 241ee02

Please sign in to comment.