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 typeThis 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
- Export target compatibility checks (roadmap §16).
Structs§
- Column
Override - A user-supplied YAML override (
exports[].columns:inrivet.yaml, roadmap §8) carries one of these per column. Stored separately fromSourceColumnso it’s obvious in code review whether a particular type came from autodetect or from an explicit override. - Cursor
State - Cursor state for incremental exports.
- Source
Column - Metadata captured from the source database for a single column,
before it is mapped to a
RivetType. - Type
Mapping - One row of the Type Mapping Pipeline (roadmap §6
TypeMapping).
Enums§
- Rivet
Type - Canonical Rivet type. Every source-driver column maps into exactly one
of these variants before we ever look at
arrow::DataType. - Time
Unit - Time-resolution unit for
RivetType::Time/RivetType::Timestamp. - Type
Fidelity - Fidelity tag attached to every
crate::types::TypeMapping.
Functions§
- build_
arrow_ field - Build an
arrow::Fieldfrom aTypeMapping, attaching the standard metadata keys ([META_NATIVE_TYPE], [META_LOGICAL_TYPE], [META_FIDELITY]). - parse_
type_ str - Parse a user-supplied column type string into a
RivetType.
Type Aliases§
- Column
Overrides - Per-export column type overrides: column name → declared
RivetType.