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 cluster_replica_size_id;
38pub mod explain;
39pub mod fixed_length;
40pub mod global_id;
41pub mod namespaces;
42pub mod network_policy_id;
43pub mod optimize;
44pub mod refresh_schedule;
45pub mod role_id;
46pub mod stats;
47pub mod strconv;
48pub mod timestamp;
49mod update;
50pub mod user;
51
52pub use crate::catalog_item_id::CatalogItemId;
53pub use crate::datum_vec::{DatumVec, DatumVecBorrow};
54pub use crate::diff::Diff;
55pub use crate::global_id::GlobalId;
56pub use crate::relation::{
57    ColumnDiff, ColumnIndex, ColumnName, KeyDiff, NotNullViolation, ORDINALITY_COL_NAME,
58    ProtoColumnName, ProtoColumnType, ProtoRelationDesc, ProtoRelationType, RelationDesc,
59    RelationDescBuilder, RelationDescDiff, RelationVersion, RelationVersionSelector,
60    ReprColumnType, ReprRelationType, SemanticType, SqlColumnType, SqlRelationType,
61    UNKNOWN_COLUMN_NAME, VersionedRelationDesc,
62};
63#[cfg(any(test, feature = "proptest"))]
64pub use crate::relation::{
65    PropRelationDescDiff, arb_relation_desc_diff, arb_relation_desc_projection,
66    arb_row_for_relation,
67};
68pub use crate::row::encode::{RowColumnarDecoder, RowColumnarEncoder, preserves_order};
69pub use crate::row::iter::{IntoRowIterator, RowIterator};
70pub use crate::row::{
71    DatumDictTypedIter, DatumList, DatumListTypedIter, DatumMap, FromDatum, ProtoNumeric, ProtoRow,
72    Row, RowArena, RowArenaBuf, RowPacker, RowRef, SharedRow, StableRow, datum_list_size,
73    datum_size, datums_size, read_datum, row_size,
74};
75pub use crate::scalar::{
76    ArrayRustType, AsColumnType, Datum, DatumKind, ExcludeNull, InputDatumType, Int2Vector,
77    OptionalArg, OutputDatumType, ProtoScalarType, ReprScalarBaseType, ReprScalarType,
78    SqlContainerType, SqlScalarBaseType, SqlScalarType, Variadic,
79};
80#[cfg(any(test, feature = "proptest"))]
81pub use crate::scalar::{
82    PropArray, PropDatum, PropDict, PropList, arb_datum, arb_datum_for_column,
83    arb_datum_for_scalar, arb_range_type,
84};
85pub use crate::timestamp::{Timestamp, TimestampManipulation, frontier_within_lag};
86pub use crate::update::{
87    Rows, RowsBuilder, SharedSlice, UpdateCollection, UpdateCollectionBuilder,
88};