Crate mz_repr

Source
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 Datum enum, which represents a literal value.
  • Row extends a Datum horizontally, and has features for efficiently doing so.
  • RelationDesc describes what it takes to extend a Row vertically, 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.
antichain
bytes
catalog_item_id
datum_vec 🔒
A re-useable vector of Datum with varying lifetimes.
diff 🔒
explain
A set of traits for modeling things that can be explained by a SQL EXPLAIN statement.
fixed_length
Provides abstractions for types that can be converted into Datum iterators. Row is the most obvious implementor, but other trace types that may use more advanced representations only need to commit to implementing these traits.
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
relation 🔒
relation_and_scalar 🔒
role_id
row 🔒
scalar 🔒
stats
Persist Stats for non-primitive types.
strconv
Routines for converting datum values to and from their string representation.
timestamp
url
Custom Protobuf types for the url crate.
user

Structs§

ArrayRustType
A new type that wraps a Vec that is used to differentiate the target Datum between Arrays and Lists. The target of this type is Array.
ColumnIndex
Stable index of a column in a RelationDesc.
ColumnName
The name of a column in a RelationDesc.
ColumnType
The type of a Datum.
DatumList
A sequence of Datums
DatumMap
A mapping from string keys to Datums
DatumVec
A re-useable vector of Datum with no particular lifetime.
DatumVecBorrow
A borrowed allocation of Datum with a specific lifetime.
NotNullViolation
Expression violated not-null constraint on named column
PropArray
PropDict
PropList
ProtoColumnName
ProtoColumnType
ProtoNumeric
See [dec::to_packed_bcd] and http://speleotrove.com/decimal/dnpack.html for more information on this format.
ProtoRelationDesc
ProtoRelationType
ProtoRow
ProtoScalarType
RelationDesc
A description of the shape of a relation.
RelationDescBuilder
A builder for a RelationDesc.
RelationType
The type of a relation.
RelationVersion
The version a given column was added at.
Row
A packed representation for Datums.
RowArena
RowArena is used to hold on to temporary Rows for functions like eval that need to create complex Datums but don’t have a Row to put them in yet.
RowColumnarDecoder
A ColumnDecoder for a Row.
RowColumnarEncoder
A ColumnEncoder for a Row.
RowPacker
Packs datums into a Row.
RowRef
A contiguous slice of bytes that are row data.
SharedRow
A thread-local row, which can be borrowed and returned.
VersionedRelationDesc
A wrapper around RelationDesc that provides an interface for adding columns and generating new versions.

Enums§

Datum
A single value.
PropDatum
A mirror type for Datum that can be proptest-generated.
PropRelationDescDiff
Diffs that can be generated proptest and applied to a RelationDesc to exercise schema migrations.
RelationVersionSelector
Describes a RelationDesc at a specific version of a VersionedRelationDesc.
ScalarBaseType
ScalarType
The type of a Datum.

Traits§

AsColumnType
Types that implement this trait can be stored in an SQL column with the specified ColumnType
DatumType
A bridge between native Rust types and SQL runtime types represented in Datums
IntoRowIterator
Convert a type into a RowIterator.
RowIterator
An iterator that can borrow from self and yield RowRefs.

Functions§

arb_datum
Generate an arbitrary PropDatum.
arb_datum_for_column
Generates an arbitrary PropDatum for the provided ColumnType.
arb_datum_for_scalar
Generates an arbitrary PropDatum for the provided ScalarType.
arb_range_type
arb_relation_desc_diff
Generates a set of PropRelationDescDiffs based on some source RelationDesc.
arb_relation_desc_projection
Returns a Strategy that generates a projection of the provided RelationDesc.
arb_row_for_relation
Returns a Strategy that yields arbitrary Rows for the provided RelationDesc.
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.