pub struct GtAccumulator { /* private fields */ }Expand description
Streaming, single-pass ground-truth builder.
pipeline.rs draws every duplicate copy of a batch exclusively from that
same batch’s masters, and writes the copies right after the batch. So at
the end of each batch, whether each of its masters is duplicated — and
whether at least one copy is byte-identical to it — is already final: no
later batch can add a copy of it. Each batch is therefore classified and
streamed straight to the final ground-truth file (IPC or Parquet) as soon
as its duplicates are known, with only two per-batch scratch bitsets as
state. Hard negatives (HN-…) and canaries (CANARY-…) are never
duplicated and are classified by kind.
This replaces an earlier two-pass design (draft file of every row +
global duplicated-master hash sets + full re-read and reclassification
at the end), which an isolated benchmark measured at ~4x the cost
(examples/profile_gt_single_pass.rs, byte-identical output).
Implementations§
Source§impl GtAccumulator
impl GtAccumulator
pub fn new( difficulty: &str, output_format: &str, final_path: &str, metadata: &BTreeMap<String, String>, track_clusters: bool, ) -> Result<Self, String>
Sourcepub fn push_entity_batch(
&mut self,
base: &BaseRows<'_>,
dups: Option<&DupRows<'_>>,
) -> Result<(), String>
pub fn push_entity_batch( &mut self, base: &BaseRows<'_>, dups: Option<&DupRows<'_>>, ) -> Result<(), String>
Classifies and writes one entity batch: its base rows first, then its
duplicate copies (dups, None when the batch has none) — the same
order they appear in the dataset.
- A base row is
uniqueif no copy of its master exists, otherwiseexact_dupif at least one copy is byte-identical to it (a base row has no noise of its own: it reads as an exact duplicate only if the cluster genuinely contains an identical twin), elsefuzzy_dup. - A copy is
exact_dupif its noise was a no-op, elsefuzzy_dup.
Sourcepub fn push_hard_neg_batch(
&mut self,
record_ids: &ArrayRef,
entity_types: &ArrayRef,
master_ids: &ArrayRef,
) -> Result<(), String>
pub fn push_hard_neg_batch( &mut self, record_ids: &ArrayRef, entity_types: &ArrayRef, master_ids: &ArrayRef, ) -> Result<(), String>
Writes a batch of hard-negative rows (HN-… masters): always
hard_neg, never part of a duplicate cluster.
Auto Trait Implementations§
impl !RefUnwindSafe for GtAccumulator
impl !Sync for GtAccumulator
impl !UnwindSafe for GtAccumulator
impl Freeze for GtAccumulator
impl Send for GtAccumulator
impl Unpin for GtAccumulator
impl UnsafeUnpin for GtAccumulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more