Skip to main content

mz_repr/
lib.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Fundamental data representation.
11//!
12//! This module contains the types for representing data in Materialize that all
13//! layers of the stack can understand. Think of it as the _lingua franca_:
14//! individual layers may use different representations internally, but they all
15//! agree to use this representation at their boundaries.
16//!
17//! * The core value type is the [`Datum`] enum, which represents a literal value.
18//! * [`Row`] extends a `Datum` horizontally, and has features for efficiently
19//!   doing so.
20//! * [`RelationDesc`] describes what it takes to extend a `Row` vertically, and
21//!   corresponds most closely to what is returned from querying our dataflows
22
23#![warn(missing_debug_implementations)]
24// TODO(parkmycar): Remove this allow.
25#![allow(unsafe_op_in_unsafe_fn)]
26
27mod datum_vec;
28mod diff;
29mod relation;
30mod relation_and_scalar;
31mod row;
32mod scalar;
33
34pub mod adt;
35pub mod bytes;
36pub mod catalog_item_id;
37pub mod explain;
38pub mod fixed_length;
39pub mod global_id;
40pub mod namespaces;
41pub mod network_policy_id;
42pub mod optimize;
43pub mod refresh_schedule;
44pub mod role_id;
45pub mod stats;
46pub mod strconv;
47pub mod timestamp;
48mod update;
49pub mod user;
50
51pub use crate::catalog_item_id::CatalogItemId;
52pub use crate::datum_vec::{DatumVec, DatumVecBorrow};
53pub use crate::diff::Diff;
54pub use crate::global_id::GlobalId;
55pub use crate::relation::{
56    ColumnDiff, ColumnIndex, ColumnName, KeyDiff, NotNullViolation, PropRelationDescDiff,
57    ProtoColumnName, ProtoColumnType, ProtoRelationDesc, ProtoRelationType, RelationDesc,
58    RelationDescBuilder, RelationDescDiff, RelationVersion, RelationVersionSelector,
59    ReprColumnType, ReprRelationType, SqlColumnType, SqlRelationType, UNKNOWN_COLUMN_NAME,
60    VersionedRelationDesc, arb_relation_desc_diff, arb_relation_desc_projection,
61    arb_row_for_relation,
62};
63pub use crate::row::encode::{RowColumnarDecoder, RowColumnarEncoder, preserves_order};
64pub use crate::row::iter::{IntoRowIterator, RowIterator};
65pub use crate::row::{
66    DatumDictTypedIter, DatumList, DatumListTypedIter, DatumMap, FromDatum, ProtoNumeric, ProtoRow,
67    Row, RowArena, RowPacker, RowRef, SharedRow, datum_list_size, datum_size, datums_size,
68    read_datum, row_size,
69};
70pub use crate::scalar::{
71    ArrayRustType, AsColumnType, Datum, DatumKind, ExcludeNull, InputDatumType, Int2Vector,
72    OptionalArg, OutputDatumType, PropArray, PropDatum, PropDict, PropList, ProtoScalarType,
73    ReprScalarBaseType, ReprScalarType, SqlContainerType, SqlScalarBaseType, SqlScalarType,
74    Variadic, arb_datum, arb_datum_for_column, arb_datum_for_scalar, arb_range_type,
75};
76pub use crate::timestamp::{Timestamp, TimestampManipulation};
77pub use crate::update::{
78    Rows, RowsBuilder, SharedSlice, UpdateCollection, UpdateCollectionBuilder,
79};