proof_of_sql/sql/logical_plans/expr.rs
1use crate::base::database::{ColumnRef, LiteralValue};
2use alloc::boxed::Box;
3use serde::{Deserialize, Serialize};
4
5/// Enum of column expressions that are either provable or supported in postprocessing
6#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7pub enum Expr {
8 /// Column
9 Column(ColumnRef),
10 /// A constant expression
11 Literal(LiteralValue),
12 /// Binary operation
13 Binary {
14 /// Left hand side of the binary operation
15 left: Box<Expr>,
16 /// Right hand side of the binary operation
17 right: Box<Expr>,
18 /// Binary operator
19 op: BinaryOperator,
20 },
21 /// NOT expression
22 Not(Box<Expr>),
23}
24
25/// Enum of binary operators we support
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub enum BinaryOperator {
28 /// Equals
29 Eq,
30 /// Not equals
31 NotEq,
32 /// Greater than
33 Gt,
34 /// Less than
35 Lt,
36 /// Greater than or equals
37 GtEq,
38 /// Less than or equals
39 LtEq,
40 /// Logical AND
41 And,
42 /// Logical OR
43 Or,
44 /// Plus
45 Plus,
46 /// Minus
47 Minus,
48 /// Multiply
49 Multiply,
50 /// Divide
51 Divide,
52}