-
Notifications
You must be signed in to change notification settings - Fork 7
/
syntax.rs
77 lines (65 loc) · 2.23 KB
/
syntax.rs
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
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.
use crate::{
expression::{AggrExpr, ValueExpr},
pipeline::{
name::{AggrAlias, CorrelationAlias, StreamName, ValueAlias},
pump_model::{
window_operation_parameter::join_parameter::JoinType, window_parameter::WindowParameter,
},
},
};
#[derive(Clone, Eq, PartialEq, Debug)]
pub(in crate::sql_processor) enum ColumnConstraintSyntax {
NotNull, // this is treated as data type in pipeline
Rowtime,
}
#[derive(Clone, Eq, PartialEq, Debug)]
pub(in crate::sql_processor) struct OptionSyntax {
pub(in crate::sql_processor) option_name: String,
pub(in crate::sql_processor) option_value: String,
}
#[derive(Clone, PartialEq, Debug)]
pub(in crate::sql_processor) struct SelectStreamSyntax {
pub(in crate::sql_processor) fields: Vec<SelectFieldSyntax>,
pub(in crate::sql_processor) from_item: FromItemSyntax,
/// Empty when no GROUP BY clause is supplied.
pub(in crate::sql_processor) grouping_elements: Vec<GroupingElementSyntax>,
pub(in crate::sql_processor) window_clause: Option<WindowParameter>,
}
#[derive(Clone, PartialEq, Debug)]
pub(crate) enum SelectFieldSyntax {
ValueExpr {
value_expr: ValueExpr,
alias: Option<ValueAlias>,
},
AggrExpr {
aggr_expr: AggrExpr,
alias: Option<AggrAlias>,
},
}
#[derive(Clone, PartialEq, Debug)]
pub(in crate::sql_processor) enum FromItemSyntax {
StreamVariant(SubFromItemSyntax),
JoinVariant {
left: SubFromItemSyntax,
right: Box<FromItemSyntax>,
join_type: JoinType,
on_expr: ValueExpr,
// TODO alias
},
}
#[derive(Clone, PartialEq, Debug)]
pub(in crate::sql_processor) struct SubFromItemSyntax {
pub(in crate::sql_processor) stream_name: StreamName,
pub(in crate::sql_processor) alias: Option<CorrelationAlias>,
}
#[derive(Clone, PartialEq, Debug)]
pub(in crate::sql_processor) enum GroupingElementSyntax {
ValueExpr(ValueExpr),
ValueAlias(ValueAlias),
}
#[derive(Clone, Eq, PartialEq, Debug)]
pub(in crate::sql_processor) enum DurationFunction {
Millis,
Secs,
}