From 8bd6eb06e6ac2fafcd31ed149af7bbfe42940860 Mon Sep 17 00:00:00 2001 From: Tri <61586052+triandco@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:39:36 +1000 Subject: [PATCH] feat: make SegmentMeta.with_max_doc public (#2499) * chore: add container * feat: make max doc editable externally * chore: expose another method * chore: remove comments * remove unused devcontainer * chore: manually match nightly format * chore: change weird formating * revert format change * fix: format with nightly --- columnar/src/column_index/optional_index/mod.rs | 4 +++- columnar/src/column_index/optional_index/set_block/dense.rs | 4 +++- columnar/src/column_index/optional_index/set_block/sparse.rs | 4 +++- src/index/index_meta.rs | 5 +---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/columnar/src/column_index/optional_index/mod.rs b/columnar/src/column_index/optional_index/mod.rs index a615f78a0..3960ffbec 100644 --- a/columnar/src/column_index/optional_index/mod.rs +++ b/columnar/src/column_index/optional_index/mod.rs @@ -174,7 +174,9 @@ impl<'a> SelectCursor for OptionalIndexSelectCursor<'a> { } impl Set for OptionalIndex { - type SelectCursor<'b> = OptionalIndexSelectCursor<'b> where Self: 'b; + type SelectCursor<'b> + = OptionalIndexSelectCursor<'b> + where Self: 'b; // Check if value at position is not null. #[inline] fn contains(&self, row_id: RowId) -> bool { diff --git a/columnar/src/column_index/optional_index/set_block/dense.rs b/columnar/src/column_index/optional_index/set_block/dense.rs index 08ca31b19..8b249c0d5 100644 --- a/columnar/src/column_index/optional_index/set_block/dense.rs +++ b/columnar/src/column_index/optional_index/set_block/dense.rs @@ -123,7 +123,9 @@ impl<'a> SelectCursor for DenseBlockSelectCursor<'a> { } impl<'a> Set for DenseBlock<'a> { - type SelectCursor<'b> = DenseBlockSelectCursor<'a> where Self: 'b; + type SelectCursor<'b> + = DenseBlockSelectCursor<'a> + where Self: 'b; #[inline(always)] fn contains(&self, el: u16) -> bool { diff --git a/columnar/src/column_index/optional_index/set_block/sparse.rs b/columnar/src/column_index/optional_index/set_block/sparse.rs index 52e75b95c..beee7b408 100644 --- a/columnar/src/column_index/optional_index/set_block/sparse.rs +++ b/columnar/src/column_index/optional_index/set_block/sparse.rs @@ -32,7 +32,9 @@ impl<'a> SelectCursor for SparseBlock<'a> { } impl<'a> Set for SparseBlock<'a> { - type SelectCursor<'b> = Self where Self: 'b; + type SelectCursor<'b> + = Self + where Self: 'b; #[inline(always)] fn contains(&self, el: u16) -> bool { diff --git a/src/index/index_meta.rs b/src/index/index_meta.rs index 49ef68bad..0962bd9bc 100644 --- a/src/index/index_meta.rs +++ b/src/index/index_meta.rs @@ -176,10 +176,7 @@ impl SegmentMeta { } /// Updates the max_doc value from the `SegmentMeta`. - /// - /// This method is only used when updating `max_doc` from 0 - /// as we finalize a fresh new segment. - pub(crate) fn with_max_doc(self, max_doc: u32) -> SegmentMeta { + pub fn with_max_doc(self, max_doc: u32) -> SegmentMeta { assert_eq!(self.tracked.max_doc, 0); assert!(self.tracked.deletes.is_none()); let tracked = self.tracked.map(move |inner_meta| InnerSegmentMeta {