Skip to main content

Module types

Module types 

Source
Expand description

Rivet’s internal type system.

See rivet_roadmap.md §Epic 14 (Warehouse Load Layer). North Star — “No silent type degradation” — is enforced architecturally by routing every source-column type through the pipeline:

Source Native Type
    ↓
SourceColumn  ← what the driver knows about the column
    ↓
RivetType     ← canonical, vendor-independent type
    ↓
TypePolicy    ← strict / lossy / unsupported decisions  (Chunk 4)
    ↓
Arrow DataType + Field metadata  ← physical export type

This module owns the first three boxes. The fourth (Arrow) is built by mapping::build_arrow_field; the fifth (TypePolicy) lands in Chunk 4 of the type-safety milestones (see roadmap §18).

§Layer

Layer-classification (ADR-0003): this module is planning-layer — it only describes / classifies types. It must not perform I/O, log metrics, or hold any pipeline state. Vendor mappers live in crate::source::* and call into this module.

Modules§

decimal
Exact decimal string → scaled integer conversion (roadmap §12).
policy
TypePolicy — strict / warn / allow decisions for unsafe type mappings.
target
Target-type resolver (ADR-0014 L4, roadmap §16).

Structs§

ColumnOverride
A user-supplied YAML override (exports[].columns: in rivet.yaml, roadmap §8) carries one of these per column. Stored separately from SourceColumn so it’s obvious in code review whether a particular type came from autodetect or from an explicit override.
CursorState
Cursor state for incremental exports.
SourceColumn
Metadata captured from the source database for a single column, before it is mapped to a RivetType.
TypeMapping
One row of the Type Mapping Pipeline (roadmap §6 TypeMapping).

Enums§

RivetType
Canonical Rivet type. Every source-driver column maps into exactly one of these variants before we ever look at arrow::DataType.
TimeUnit
Time-resolution unit for RivetType::Time / RivetType::Timestamp.
TypeFidelity
Fidelity tag attached to every crate::types::TypeMapping.

Functions§

build_arrow_field
Build an arrow::Field from a TypeMapping, attaching the standard metadata keys ([META_NATIVE_TYPE], [META_LOGICAL_TYPE], [META_FIDELITY]).
derive_fidelity
Compute the TypeFidelity for a freshly-resolved RivetType.
parse_type_str
Parse a user-supplied column type string into a RivetType.
resolve_or
The override precedence shared by every source engine: a columns: override wins; otherwise fall back to the engine’s autodetected type. Keeping it in one place is why PostgreSQL and MySQL resolution can’t drift on precedence — each driver supplies only its own autodetect closure.
rivet_type_to_arrow
Map RivetType → [arrow::DataType].

Type Aliases§

ColumnOverrides
Per-export column type overrides: column name → declared RivetType.