1#![warn(missing_debug_implementations)]
13
14use std::collections::BTreeSet;
15use std::ops::Deref;
16
17use mz_repr::GlobalId;
18use serde::{Deserialize, Serialize};
19
20mod id;
21mod interpret;
22mod linear;
23mod relation;
24mod scalar;
25
26pub mod explain;
27pub mod row;
28pub mod virtual_syntax;
29pub mod visit;
30
31pub use id::{Id, LocalId, SourceInstanceId};
32pub use interpret::{
33 ColumnSpec, ColumnSpecs, Interpretable, Interpreter, ResultSpec, Trace, TraceSummary,
34};
35pub use linear::plan::{MfpPlan, SafeMfpPlan};
36pub use linear::util::{join_permutations, permutation_for_arrangement};
37pub use linear::{MapFilterProject, memoize_expr};
38pub use relation::func::REPEAT_ROW_NAME;
39pub use relation::func::order_aggregate_datums as order_aggregate_datums_exported_for_benchmarking;
40pub use relation::func::{
41 AggregateFunc, AnalyzedRegex, AnalyzedRegexOpts, CaptureGroupDesc, LagLeadType,
42 NaiveOneByOneAggr, OneByOneAggr, TableFunc,
43};
44pub use relation::join_input_mapper::JoinInputMapper;
45pub use relation::{
46 AccessStrategy, AggregateExpr, CollectionPlan, ColumnOrder, JoinImplementation,
47 JoinInputCharacteristics, LetRecLimit, MirRelationExpr, RECURSION_LIMIT, RowComparator,
48 RowSetFinishing, RowSetFinishingIncremental, WindowFrame, WindowFrameBound, WindowFrameUnits,
49 canonicalize, compare_columns, non_nullable_columns,
50};
51pub use scalar::func::{self, BinaryFunc, UnaryFunc, UnmaterializableFunc, VariadicFunc};
52pub use scalar::{
53 Columns, DomainLimit, Eval, EvalError, FilterCharacteristics, MirScalarExpr, OptimizableExpr,
54 ProtoDomainLimit, ProtoEvalError, StableEvalError, StableEvalErrorRef, like_pattern,
55};
56
57#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
60pub struct OptimizedMirRelationExpr(pub MirRelationExpr);
61
62impl OptimizedMirRelationExpr {
63 pub fn declare_optimized(expr: MirRelationExpr) -> OptimizedMirRelationExpr {
68 OptimizedMirRelationExpr(expr)
69 }
70
71 pub fn as_inner(&self) -> &MirRelationExpr {
76 &self.0
77 }
78
79 pub fn as_inner_mut(&mut self) -> &mut MirRelationExpr {
84 &mut self.0
85 }
86
87 pub fn into_inner(self) -> MirRelationExpr {
88 self.0
89 }
90}
91
92impl Deref for OptimizedMirRelationExpr {
93 type Target = MirRelationExpr;
94
95 fn deref(&self) -> &Self::Target {
96 &self.0
97 }
98}
99
100impl CollectionPlan for OptimizedMirRelationExpr {
101 fn depends_on_into(&self, out: &mut BTreeSet<GlobalId>) {
102 self.0.depends_on_into(out)
103 }
104}