mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-08-18 12:08:22 +00:00
feat(log-query): support binary op, scalar fn & is_true/is_false (#6659)
* rename symbol Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * handle binary op Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update test results Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Update src/query/src/log_query/planner.rs Co-authored-by: Yingwen <realevenyag@gmail.com> * fix format Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * reduce duplication Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Yingwen <realevenyag@gmail.com>
This commit is contained in:
@@ -82,7 +82,7 @@ pub enum LogExpr {
|
||||
},
|
||||
BinaryOp {
|
||||
left: Box<LogExpr>,
|
||||
op: String,
|
||||
op: BinaryOperator,
|
||||
right: Box<LogExpr>,
|
||||
},
|
||||
Alias {
|
||||
@@ -326,14 +326,38 @@ pub enum ContentFilter {
|
||||
inclusive: bool,
|
||||
},
|
||||
In(Vec<String>),
|
||||
// TODO(ruihang): arithmetic operations
|
||||
IsTrue,
|
||||
IsFalse,
|
||||
|
||||
// Compound filters
|
||||
Compound(Vec<ContentFilter>, BinaryOperator),
|
||||
Compound(Vec<ContentFilter>, ConjunctionOperator),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ConjunctionOperator {
|
||||
And,
|
||||
Or,
|
||||
}
|
||||
|
||||
/// Binary operators for LogExpr::BinaryOp.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum BinaryOperator {
|
||||
// Comparison operators
|
||||
Eq,
|
||||
Ne,
|
||||
Lt,
|
||||
Le,
|
||||
Gt,
|
||||
Ge,
|
||||
|
||||
// Arithmetic operators
|
||||
Plus,
|
||||
Minus,
|
||||
Multiply,
|
||||
Divide,
|
||||
Modulo,
|
||||
|
||||
// Logical operators
|
||||
And,
|
||||
Or,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user