1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum ArrayDimType {
13 Int64,
14 Float64,
15 TimestampMs,
16 String,
17}
18
19#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum ArrayAttrType {
22 Int64,
23 Float64,
24 String,
25 Bytes,
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
30pub enum ArrayCellOrderAst {
31 RowMajor,
32 ColMajor,
33 #[default]
34 Hilbert,
35 ZOrder,
36}
37
38#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
40pub enum ArrayTileOrderAst {
41 RowMajor,
42 ColMajor,
43 #[default]
44 Hilbert,
45 ZOrder,
46}
47
48#[derive(Debug, Clone, PartialEq)]
50pub enum ArrayDomainBound {
51 Int64(i64),
52 Float64(f64),
53 TimestampMs(i64),
54 String(String),
55}
56
57#[derive(Debug, Clone, PartialEq)]
59pub struct ArrayDimAst {
60 pub name: String,
61 pub dtype: ArrayDimType,
62 pub lo: ArrayDomainBound,
63 pub hi: ArrayDomainBound,
64}
65
66#[derive(Debug, Clone, PartialEq)]
68pub struct ArrayAttrAst {
69 pub name: String,
70 pub dtype: ArrayAttrType,
71 pub nullable: bool,
72}
73
74#[derive(Debug, Clone, PartialEq)]
78pub enum ArrayCoordLiteral {
79 Int64(i64),
80 Float64(f64),
81 String(String),
82}
83
84#[derive(Debug, Clone, PartialEq)]
87pub enum ArrayAttrLiteral {
88 Int64(i64),
89 Float64(f64),
90 String(String),
91 Bytes(Vec<u8>),
92 Null,
93}
94
95#[derive(Debug, Clone, PartialEq)]
97pub struct ArrayInsertRow {
98 pub coords: Vec<ArrayCoordLiteral>,
99 pub attrs: Vec<ArrayAttrLiteral>,
100}
101
102#[derive(Debug, Clone, PartialEq)]
107pub struct NamedDimRange {
108 pub dim: String,
110 pub lo: ArrayCoordLiteral,
111 pub hi: ArrayCoordLiteral,
112}
113
114#[derive(Debug, Clone, Default, PartialEq)]
118pub struct ArraySliceAst {
119 pub dim_ranges: Vec<NamedDimRange>,
120}
121
122#[derive(Debug, Clone, Copy, PartialEq, Eq)]
125pub enum ArrayReducerAst {
126 Sum,
127 Count,
128 Min,
129 Max,
130 Mean,
131}
132
133impl ArrayReducerAst {
134 pub fn parse(s: &str) -> Option<Self> {
138 match s.to_ascii_lowercase().as_str() {
139 "sum" => Some(ArrayReducerAst::Sum),
140 "count" => Some(ArrayReducerAst::Count),
141 "min" => Some(ArrayReducerAst::Min),
142 "max" => Some(ArrayReducerAst::Max),
143 "mean" | "avg" => Some(ArrayReducerAst::Mean),
144 _ => None,
145 }
146 }
147}
148
149#[derive(Debug, Clone, Copy, PartialEq, Eq)]
152pub enum ArrayBinaryOpAst {
153 Add,
154 Sub,
155 Mul,
156 Div,
157}
158
159impl ArrayBinaryOpAst {
160 pub fn parse(s: &str) -> Option<Self> {
161 match s.to_ascii_lowercase().as_str() {
162 "add" | "+" => Some(ArrayBinaryOpAst::Add),
163 "sub" | "-" => Some(ArrayBinaryOpAst::Sub),
164 "mul" | "*" => Some(ArrayBinaryOpAst::Mul),
165 "div" | "/" => Some(ArrayBinaryOpAst::Div),
166 _ => None,
167 }
168 }
169}