Skip to main content

GtAccumulator

Struct GtAccumulator 

Source
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

Source

pub fn new( difficulty: &str, output_format: &str, final_path: &str, metadata: &BTreeMap<String, String>, track_clusters: bool, ) -> Result<Self, String>

Source

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 unique if no copy of its master exists, otherwise exact_dup if 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), else fuzzy_dup.
  • A copy is exact_dup if its noise was a no-op, else fuzzy_dup.
Source

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.

Source

pub fn push_canary_batch( &mut self, record_ids: &ArrayRef, entity_types: &ArrayRef, master_ids: &ArrayRef, ) -> Result<(), String>

Writes a batch of canary rows (CANARY-… masters, see canary.rs): always canary, not counted in any statistic.

Source

pub fn finish(self) -> Result<GtResult, String>

Closes the ground-truth file and returns the run’s statistics (plus the duplicate-cluster map, when tracked).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.