diff --git a/src/ast/data_type.rs b/src/ast/data_type.rs index 4aede8590..551622729 100644 --- a/src/ast/data_type.rs +++ b/src/ast/data_type.rs @@ -13,7 +13,7 @@ use super::ObjectName; /// SQL data types -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum DataType { /// Fixed-length character type e.g. CHAR(10) Char(Option), diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index 3f7c42819..a42f02583 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -3,7 +3,7 @@ use super::{DataType, Expr, Ident, ObjectName}; /// An `ALTER TABLE` (`SQLStatement::SQLAlterTable`) operation -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AlterTableOperation { /// `ADD ` AddConstraint(TableConstraint), @@ -22,7 +22,7 @@ impl ToString for AlterTableOperation { /// A table-level constraint, specified in a `CREATE TABLE` or an /// `ALTER TABLE ADD ` statement. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TableConstraint { /// `[ CONSTRAINT ] { PRIMARY KEY | UNIQUE } ()` Unique { @@ -81,7 +81,7 @@ impl ToString for TableConstraint { } /// SQL column definition -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ColumnDef { pub name: Ident, pub data_type: DataType, @@ -120,7 +120,7 @@ impl ToString for ColumnDef { /// For maximum flexibility, we don't distinguish between constraint and /// non-constraint options, lumping them all together under the umbrella of /// "column options," and we allow any column option to be named. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ColumnOptionDef { pub name: Option, pub option: ColumnOption, @@ -138,7 +138,7 @@ impl ToString for ColumnOptionDef { /// `ColumnOption`s are modifiers that follow a column definition in a `CREATE /// TABLE` statement. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ColumnOption { /// `NULL` Null, diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 066731ce0..66dfeaa07 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -52,7 +52,7 @@ pub type Ident = String; /// The parser does not distinguish between expressions of different types /// (e.g. boolean vs string), so the caller must handle expressions of /// inappropriate type, like `WHERE 1` or `SELECT 1=1`, as necessary. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Expr { /// Identifier e.g. table name or column name Identifier(Ident), @@ -232,7 +232,7 @@ impl ToString for Expr { } /// A window specification (i.e. `OVER (PARTITION BY .. ORDER BY .. etc.)`) -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WindowSpec { pub partition_by: Vec, pub order_by: Vec, @@ -276,7 +276,7 @@ impl ToString for WindowSpec { /// Specifies the data processed by a window function, e.g. /// `RANGE UNBOUNDED PRECEDING` or `ROWS BETWEEN 5 PRECEDING AND CURRENT ROW`. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WindowFrame { pub units: WindowFrameUnits, pub start_bound: WindowFrameBound, @@ -285,7 +285,7 @@ pub struct WindowFrame { // TBD: EXCLUDE } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum WindowFrameUnits { Rows, Range, @@ -318,7 +318,7 @@ impl FromStr for WindowFrameUnits { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum WindowFrameBound { /// "CURRENT ROW" CurrentRow, @@ -343,7 +343,7 @@ impl ToString for WindowFrameBound { /// A top-level statement (SELECT, INSERT, CREATE, etc.) #[allow(clippy::large_enum_variant)] -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Statement { /// SELECT Query(Box), @@ -588,7 +588,7 @@ impl ToString for Statement { } /// A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ObjectName(pub Vec); impl ToString for ObjectName { @@ -598,7 +598,7 @@ impl ToString for ObjectName { } /// SQL assignment `foo = expr` as used in SQLUpdate -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Assignment { pub id: Ident, pub value: Expr, @@ -611,7 +611,7 @@ impl ToString for Assignment { } /// SQL function -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Function { pub name: ObjectName, pub args: Vec, @@ -636,7 +636,7 @@ impl ToString for Function { } /// External table's available file format -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum FileFormat { TEXTFILE, SEQUENCEFILE, @@ -685,7 +685,7 @@ impl FromStr for FileFormat { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ObjectType { Table, View, @@ -700,7 +700,7 @@ impl ObjectType { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SqlOption { pub name: Ident, pub value: Value, @@ -712,7 +712,7 @@ impl ToString for SqlOption { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TransactionMode { AccessMode(TransactionAccessMode), IsolationLevel(TransactionIsolationLevel), @@ -728,7 +728,7 @@ impl ToString for TransactionMode { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TransactionAccessMode { ReadOnly, ReadWrite, @@ -744,7 +744,7 @@ impl ToString for TransactionAccessMode { } } -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TransactionIsolationLevel { ReadUncommitted, ReadCommitted, diff --git a/src/ast/operator.rs b/src/ast/operator.rs index 32626e4f1..2d311c674 100644 --- a/src/ast/operator.rs +++ b/src/ast/operator.rs @@ -11,7 +11,7 @@ // limitations under the License. /// Unary operators -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum UnaryOperator { Plus, Minus, @@ -29,7 +29,7 @@ impl ToString for UnaryOperator { } /// Binary operators -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum BinaryOperator { Plus, Minus, diff --git a/src/ast/query.rs b/src/ast/query.rs index 2d09d821c..c95226c7b 100644 --- a/src/ast/query.rs +++ b/src/ast/query.rs @@ -14,7 +14,7 @@ use super::*; /// The most complete variant of a `SELECT` query expression, optionally /// including `WITH`, `UNION` / other set operations, and `ORDER BY`. -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Query { /// WITH (common table expressions, or CTEs) pub ctes: Vec, @@ -56,7 +56,7 @@ impl ToString for Query { /// A node in a tree, representing a "query body" expression, roughly: /// `SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]` -#[derive(Debug, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum SetExpr { /// Restricted SELECT .. FROM .. HAVING (no ORDER BY or set operations) Select(Box