Skip to main content

Comparator

Trait Comparator 

Source
pub trait Comparator: Send + Sync {
    // Required method
    fn compare(
        &self,
        a: &Record,
        b: &Record,
        schema: &Schema,
    ) -> ComparisonVector;

    // Provided method
    fn compare_batch_from_pool(
        &self,
        pool: &RecordPool,
        indices: &[(usize, usize)],
        schema: &Schema,
    ) -> ComparisonBatch { ... }
}

Required Methods§

Source

fn compare(&self, a: &Record, b: &Record, schema: &Schema) -> ComparisonVector

Compare a single pair, always CPU, returns an individual vector.

Provided Methods§

Source

fn compare_batch_from_pool( &self, pool: &RecordPool, indices: &[(usize, usize)], schema: &Schema, ) -> ComparisonBatch

Pool-native batch comparison, the primary hot path.

Reads RecordPool columns directly: zero HashMap lookups, no Record::clone(). Implementors SHOULD override this method. The default falls back to compare per pair, which is correct but slower than a native pool implementation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§