pub struct SchemaFingerprint {
pub schema_hash: [u8; 32],
pub field_stats: Vec<FieldStats>,
pub record_count: u64,
pub created_at: u64,
}Expand description
Fingerprint that identifies a schema structure plus its data distribution.
Two SchemaFingerprints with equal schema_hash are structurally identical
(same field names and kinds, regardless of order). The field_stats carry
distribution information used by the nearest-neighbor warm-start heuristic.
Fields§
§schema_hash: [u8; 32]SHA-256 of sorted (name, kind) pairs, stable across field-ordering.
field_stats: Vec<FieldStats>One entry per schema field; empty when built with Self::from_schema.
record_count: u64Number of records in the sample; 0 when built with Self::from_schema.
created_at: u64Unix timestamp (seconds) when this fingerprint was created.
Implementations§
Source§impl SchemaFingerprint
impl SchemaFingerprint
Sourcepub fn from_schema(schema: &Schema) -> SchemaFingerprint
pub fn from_schema(schema: &Schema) -> SchemaFingerprint
Build a structure-only fingerprint from a schema definition.
field_stats is populated with zero-value statistics for each field so
that the Jaccard similarity computation in crate::similarity can
always access the field names and kinds, even without sample data.
Sourcepub fn from_schema_with_mappings(
schema: &Schema,
mappings: &[FieldMapping],
) -> SchemaFingerprint
pub fn from_schema_with_mappings( schema: &Schema, mappings: &[FieldMapping], ) -> SchemaFingerprint
Like Self::from_schema but includes cross-schema mappings in the hash
so warm-start artifacts from same-schema runs are never reused.
Sourcepub fn from_sample(schema: &Schema, records: &[Record]) -> SchemaFingerprint
pub fn from_sample(schema: &Schema, records: &[Record]) -> SchemaFingerprint
Build a full fingerprint from a schema and a sample of records.
50–100 records per field is typically enough for reliable statistics.
The schema_hash is identical to what Self::from_schema would produce for
the same schema, so exact-hash lookups still work.
Sourcepub fn from_sample_with_mappings(
schema: &Schema,
records: &[Record],
mappings: &[FieldMapping],
) -> SchemaFingerprint
pub fn from_sample_with_mappings( schema: &Schema, records: &[Record], mappings: &[FieldMapping], ) -> SchemaFingerprint
Like Self::from_sample but includes cross-schema mappings in the hash.
Trait Implementations§
Source§impl Clone for SchemaFingerprint
impl Clone for SchemaFingerprint
Source§fn clone(&self) -> SchemaFingerprint
fn clone(&self) -> SchemaFingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaFingerprint
impl Debug for SchemaFingerprint
Source§impl<'de> Deserialize<'de> for SchemaFingerprint
impl<'de> Deserialize<'de> for SchemaFingerprint
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaFingerprint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaFingerprint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for SchemaFingerprint
impl Serialize for SchemaFingerprint
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SchemaFingerprint
impl RefUnwindSafe for SchemaFingerprint
impl Send for SchemaFingerprint
impl Sync for SchemaFingerprint
impl Unpin for SchemaFingerprint
impl UnsafeUnpin for SchemaFingerprint
impl UnwindSafe for SchemaFingerprint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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