1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#![warn(missing_debug_implementations)]
use std::fmt;
use std::ops::Deref;
use serde::{Deserialize, Serialize};
use repr::{ColumnType, ScalarType};
mod id;
mod linear;
mod relation;
mod scalar;
pub mod explain;
pub use relation::canonicalize;
pub use id::{GlobalId, Id, LocalId, PartitionId, SourceInstanceId};
pub use linear::{
memoize_expr,
plan::{MfpPlan, SafeMfpPlan},
util::{join_permutations, permutation_for_arrangement},
MapFilterProject,
};
pub use relation::func::{AggregateFunc, TableFunc};
pub use relation::func::{AnalyzedRegex, CaptureGroupDesc};
pub use relation::join_input_mapper::JoinInputMapper;
pub use relation::{
compare_columns, AggregateExpr, ColumnOrder, JoinImplementation, MirRelationExpr,
RowSetFinishing, RECURSION_LIMIT,
};
pub use scalar::func::{self, BinaryFunc, NullaryFunc, UnaryFunc, VariadicFunc};
pub use scalar::{like_pattern, EvalError, MirScalarExpr};
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Hash)]
pub struct OptimizedMirRelationExpr(pub MirRelationExpr);
impl OptimizedMirRelationExpr {
pub fn declare_optimized(expr: MirRelationExpr) -> OptimizedMirRelationExpr {
OptimizedMirRelationExpr(expr)
}
pub fn as_inner_mut(&mut self) -> &mut MirRelationExpr {
&mut self.0
}
pub fn into_inner(self) -> MirRelationExpr {
self.0
}
}
impl Deref for OptimizedMirRelationExpr {
type Target = MirRelationExpr;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub trait ExprHumanizer: fmt::Debug {
fn humanize_id(&self, id: GlobalId) -> Option<String>;
fn humanize_scalar_type(&self, ty: &ScalarType) -> String;
fn humanize_column_type(&self, typ: &ColumnType) -> String {
format!(
"{}{}",
self.humanize_scalar_type(&typ.scalar_type),
if typ.nullable { "?" } else { "" }
)
}
}
#[derive(Debug)]
pub struct DummyHumanizer;
impl ExprHumanizer for DummyHumanizer {
fn humanize_id(&self, _: GlobalId) -> Option<String> {
None
}
fn humanize_scalar_type(&self, ty: &ScalarType) -> String {
format!("{:?}", ty)
}
}