Expand description
Fundamental data representation.
This module contains the types for representing data in Materialize that all layers of the stack can understand. Think of it as the lingua franca: individual layers may use different representations internally, but they all agree to use this representation at their boundaries.
- The core value type is the
Datumenum, which represents a literal value. Rowextends aDatumhorizontally, and has features for efficiently doing so.RelationDescdescribes what it takes to extend aRowvertically, and corresponds most closely to what is returned from querying our dataflows
Re-exports§
pub use crate::catalog_item_id::CatalogItemId;pub use crate::global_id::GlobalId;pub use crate::timestamp::Timestamp;pub use crate::timestamp::TimestampManipulation;
Modules§
- adt
- Abstract data types.
- bytes
- catalog_
item_ id - explain
- A set of traits for modeling things that can be explained by a
SQL
EXPLAINstatement. - fixed_
length - Provides abstractions for types that can append their datums to a vector.
Rowis the most obvious implementor, but other trace types that may use more advanced representations only need to commit to implementing this trait. - global_
id - namespaces
- Namespace constants to share between high- and low-levels of the system.
- network_
policy_ id - optimize
- Facilities for defining optimizer feature flags.
- refresh_
schedule - role_id
- stats
- Persist Stats for non-primitive types.
- strconv
- Routines for converting datum values to and from their string representation.
- timestamp
- user
Structs§
- Array
Rust Type - A new type that wraps a
Vecthat is used to differentiate the targetDatumbetween Arrays and Lists. The target of this type is Array. - Column
Index - Stable index of a column in a
RelationDesc. - Column
Name - The name of a column in a
RelationDesc. - Datum
Dict Typed Iter - Datum
List - A sequence of Datums
- Datum
List Typed Iter - Datum
Map - A mapping from string keys to Datums
- Datum
Vec - A re-useable vector of
Datumwith no particular lifetime. - Datum
VecBorrow - A borrowed allocation of
Datumwith a specific lifetime. - Exclude
Null - A wrapper type that excludes
NULLvalues, even ifBallows them. - Int2
Vector - PostgreSQL’s
int2vectortype: a thin wrapper over a 1-dimensionalArrayofint2, kept distinct from a regularint2[]array because it forbidsNULLelements. - KeyDiff
- A difference in the keys of two
RelationDescs. - NotNull
Violation - Expression violated not-null constraint on named column
- Optional
Arg - Wrapper to distinguish “argument may not be present” from
Option<T>(nullable). - Prop
Array - Prop
Dict - Prop
List - Proto
Column Name - Proto
Column Type - Proto
Numeric - See [dec::to_packed_bcd] and http://speleotrove.com/decimal/dnpack.html for more information on this format.
- Proto
Relation Desc - Proto
Relation Type - Proto
Row - Proto
Scalar Type - Relation
Desc - A description of the shape of a relation.
- Relation
Desc Builder - A builder for a
RelationDesc. - Relation
Desc Diff - The result of comparing two
RelationDescs. - Relation
Version - The version a given column was added at.
- Repr
Column Type - Repr
Relation Type - The type of a relation.
- Row
- A packed representation for
Datums. - RowArena
RowArenais used to hold on to temporaryRows for functions likeevalthat need to create complexDatums but don’t have aRowto put them in yet.- RowArena
Buf - A growable, writeable byte buffer that builds a value into a
RowArena’s scratch space. - RowColumnar
Decoder - A
ColumnDecoderfor aRow. - RowColumnar
Encoder - A
ColumnEncoderfor aRow. - RowPacker
- Packs datums into a
Row. - RowRef
- A contiguous slice of bytes that are row data.
- Rows
- A packed representation of a set of rows.
- Rows
Builder - See Rows.
- Shared
Row - A thread-local row, which can be borrowed and returned.
- Shared
Slice - An immutable, shared slice. Morally, this is bytes::Bytes but with fewer features and supporting arbitrary types.
- SqlColumn
Type - The type of a
Datum. - SqlRelation
Type - The type of a relation.
- Update
Collection - A collection of row-time-diff updates in a columnar format.
- Update
Collection Builder - Variadic
- A wrapper type for variadic arguments that consumes the remaining iterator.
- Versioned
Relation Desc - A wrapper around
RelationDescthat provides an interface for adding columns and generating new versions.
Enums§
- Column
Diff - A difference in a column between two
RelationDescs. - Datum
- A single value.
- Datum
Kind - Prop
Datum - A mirror type for
Datumthat can be proptest-generated. - Prop
Relation Desc Diff - Diffs that can be generated proptest and applied to a
RelationDescto exercise schema migrations. - Relation
Version Selector - Describes a
RelationDescat a specific version of aVersionedRelationDesc. - Repr
Scalar Base Type - Repr
Scalar Type - The type of a
Datumas it is represented. - Semantic
Type - Semantic type annotation for a column in a builtin catalog relation.
- SqlScalar
Base Type - SqlScalar
Type - The type of a
Datum.
Constants§
- UNKNOWN_
COLUMN_ NAME - Default name of a column (when no other information is known).
Traits§
- AsColumn
Type - Types that implement this trait can be stored in an SQL column with the specified SqlColumnType
- From
Datum - Infallible conversion from a
Datumto a typed value. - Input
Datum Type - A bridge between native Rust types and SQL runtime types represented in Datums
- Into
RowIterator - Convert a type into a
RowIterator. - Output
Datum Type - A bridge between native Rust types and SQL runtime types represented in Datums
- RowIterator
- An iterator that can borrow from
selfand yieldRowRefs. - SqlContainer
Type - Trait for SQL container types whose element/value type can be extracted
from or wrapped into a
SqlScalarType.
Functions§
- arb_
datum - Generate an arbitrary
PropDatum. - arb_
datum_ for_ column - Generates an arbitrary
PropDatumfor the providedSqlColumnType. - arb_
datum_ for_ scalar - Generates an arbitrary
PropDatumfor the providedSqlScalarType. - arb_
range_ type - arb_
relation_ desc_ diff - Generates a set of
PropRelationDescDiffs based on some sourceRelationDesc. - arb_
relation_ desc_ projection - Returns a
Strategythat generates a projection of the providedRelationDesc. - arb_
row_ for_ relation - Returns a
Strategythat yields arbitraryRows for the providedRelationDesc. - datum_
list_ size - Number of bytes required by a list of datums. This computes the size that would be required if the given datums were packed into a list.
- datum_
size - Number of bytes required by the datum. This is used to optimistically pre-allocate buffers for packing rows.
- datums_
size - Number of bytes required by a sequence of datums.
- preserves_
order - Returns true iff the ordering of the “raw” and Persist-encoded versions of this columm would match:
ie.
sort(encode(column)) == encode(sort(column)). This encoding has been designed so that this is true for many types. - read_
datum ⚠ - Read a datum starting at byte
offset. - row_
size - Return the number of bytes these Datums would use if packed as a Row.
Type Aliases§
- Diff
- System-wide record count difference type.