Skip to main content

Module schema

Module schema 

Source
Expand description

Schema inference, resolution, and evolution framework. Schema inference, resolution, and evolution framework.

This module implements the foundation of LaminarDB’s extensible connector schema system (F-SCHEMA-001/002/003):

  • Capability traits (traits) — six opt-in traits that connectors implement to declare schema capabilities
  • Schema resolver (resolver) — five-level priority chain for determining a source’s Arrow schema
  • Format inference (inference) — registry of format-specific schema inferencers with built-in JSON, CSV, and raw support
  • Bridge adapters (bridge) — adapters between legacy RecordDeserializer / RecordSerializer and the new FormatDecoder / FormatEncoder traits
  • JSON format (json) — JSON decoder, encoder, and JSONB binary format (F-SCHEMA-004)
  • CSV format ([csv]) — CSV decoder with DuckDB-style type coercion (F-SCHEMA-005)
  • Schema evolution (evolution) — diff, evaluate, and apply schema changes with configurable compatibility modes (F-SCHEMA-009)

§Architecture

SourceConnector
  ├── as_schema_provider()      → SchemaProvider
  ├── as_schema_inferable()     → SchemaInferable
  ├── as_schema_registry_aware()→ SchemaRegistryAware
  └── as_schema_evolvable()     → SchemaEvolvable

SchemaResolver::resolve()
  1. Full DDL         → Declared
  2. Registry         → Registry { schema_id }
  3. Provider         → SourceProvided
  4. Inference        → Inferred { sample_count }
  5. Error

Re-exports§

pub use csv::CsvDecoder;
pub use csv::CsvDecoderConfig;
pub use csv::FieldCountMismatchStrategy;
pub use error::SchemaError;
pub use error::SchemaResult;
pub use evolution::diff_schemas_by_name;
pub use evolution::is_safe_widening;
pub use evolution::DefaultSchemaEvolver;
pub use evolution::EvolutionResult;
pub use evolution::EvolutionTrigger;
pub use evolution::SchemaEvolutionEngine;
pub use evolution::SchemaHistory;
pub use evolution::SchemaHistoryEntry;
pub use inference::CsvFormatInference;
pub use inference::FormatInference;
pub use inference::FormatInferenceRegistry;
pub use inference::JsonFormatInference;
pub use inference::RawFormatInference;
pub use inference::FORMAT_INFERENCE_REGISTRY;
pub use json::JsonDecoder;
pub use json::JsonDecoderConfig;
pub use json::JsonEncoder;
pub use json::JsonbAccessor;
pub use json::JsonbEncoder;
pub use json::TypeMismatchStrategy;
pub use json::UnknownFieldStrategy;
pub use parquet::ParquetDecoder;
pub use parquet::ParquetDecoderConfig;
pub use parquet::ParquetEncoder;
pub use parquet::ParquetEncoderConfig;
pub use parquet::ParquetSchemaProvider;
pub use parquet::RowGroupPredicate;
pub use resolver::DeclaredColumn;
pub use resolver::DeclaredSchema;
pub use resolver::FieldOrigin;
pub use resolver::ResolutionKind;
pub use resolver::ResolvedSchema;
pub use resolver::SchemaResolver;
pub use traits::ArrayInference;
pub use traits::ColumnProjection;
pub use traits::CompatibilityMode;
pub use traits::ConfigOption;
pub use traits::ConfigValueType;
pub use traits::ConnectorConfigSchema;
pub use traits::EvolutionVerdict;
pub use traits::FieldInferenceDetail;
pub use traits::FormatDecoder;
pub use traits::FormatEncoder;
pub use traits::InferenceConfig;
pub use traits::InferenceWarning;
pub use traits::InferredSchema;
pub use traits::NumberInference;
pub use traits::RegisteredSchema;
pub use traits::RegistryConfig;
pub use traits::RegistryCredentials;
pub use traits::RegistrySchemaType;
pub use traits::SchemaChange;
pub use traits::SchemaEvolvable;
pub use traits::SchemaInferable;
pub use traits::SchemaProvider;
pub use traits::SchemaRegistryAware;
pub use traits::WarningSeverity;
pub use types::FieldMeta;
pub use types::RawRecord;
pub use types::SinkConfig;
pub use types::SourceConfig;
pub use types::SourceMetadata;

Modules§

bridge
Bridge adapters between legacy serde traits and the new schema traits.
csv
CSV format decoder implementing FormatDecoder.
error
Schema error types.
evolution
Schema evolution engine (F-SCHEMA-009).
inference
Format inference registry and built-in format inferencers.
json
JSON format decoder, encoder, and JSONB binary format.
parquet
Parquet format decoder, encoder, and schema provider (F-SCHEMA-007).
resolver
Schema resolver and merge engine.
traits
Capability traits for the extensible connector framework.
types
Schema types used across the connector framework.