Skip to content

Commit 40f5d96

Browse files
committed
Merge branch 'eq' into master-wip
2 parents cbbc753 + bb721cb commit 40f5d96

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

src/ast/data_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use super::ObjectName;
1414

1515
/// SQL data types
16-
#[derive(Debug, Clone, PartialEq, Hash)]
16+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1717
pub enum DataType {
1818
/// Fixed-length character type e.g. CHAR(10)
1919
Char(Option<u64>),

src/ast/ddl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use super::{DataType, Expr, Ident, ObjectName};
44

55
/// An `ALTER TABLE` (`SQLStatement::SQLAlterTable`) operation
6-
#[derive(Debug, Clone, PartialEq, Hash)]
6+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
77
pub enum AlterTableOperation {
88
/// `ADD <table_constraint>`
99
AddConstraint(TableConstraint),
@@ -22,7 +22,7 @@ impl ToString for AlterTableOperation {
2222

2323
/// A table-level constraint, specified in a `CREATE TABLE` or an
2424
/// `ALTER TABLE ADD <constraint>` statement.
25-
#[derive(Debug, Clone, PartialEq, Hash)]
25+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2626
pub enum TableConstraint {
2727
/// `[ CONSTRAINT <name> ] { PRIMARY KEY | UNIQUE } (<columns>)`
2828
Unique {
@@ -81,7 +81,7 @@ impl ToString for TableConstraint {
8181
}
8282

8383
/// SQL column definition
84-
#[derive(Debug, Clone, PartialEq, Hash)]
84+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8585
pub struct ColumnDef {
8686
pub name: Ident,
8787
pub data_type: DataType,
@@ -120,7 +120,7 @@ impl ToString for ColumnDef {
120120
/// For maximum flexibility, we don't distinguish between constraint and
121121
/// non-constraint options, lumping them all together under the umbrella of
122122
/// "column options," and we allow any column option to be named.
123-
#[derive(Debug, Clone, PartialEq, Hash)]
123+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
124124
pub struct ColumnOptionDef {
125125
pub name: Option<Ident>,
126126
pub option: ColumnOption,
@@ -138,7 +138,7 @@ impl ToString for ColumnOptionDef {
138138

139139
/// `ColumnOption`s are modifiers that follow a column definition in a `CREATE
140140
/// TABLE` statement.
141-
#[derive(Debug, Clone, PartialEq, Hash)]
141+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
142142
pub enum ColumnOption {
143143
/// `NULL`
144144
Null,

src/ast/mod.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub type Ident = String;
5353
/// The parser does not distinguish between expressions of different types
5454
/// (e.g. boolean vs string), so the caller must handle expressions of
5555
/// inappropriate type, like `WHERE 1` or `SELECT 1=1`, as necessary.
56-
#[derive(Debug, Clone, PartialEq, Hash)]
56+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5757
pub enum Expr {
5858
/// Identifier e.g. table name or column name
5959
Identifier(Ident),
@@ -233,7 +233,7 @@ impl ToString for Expr {
233233
}
234234

235235
/// A window specification (i.e. `OVER (PARTITION BY .. ORDER BY .. etc.)`)
236-
#[derive(Debug, Clone, PartialEq, Hash)]
236+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
237237
pub struct WindowSpec {
238238
pub partition_by: Vec<Expr>,
239239
pub order_by: Vec<OrderByExpr>,
@@ -277,7 +277,7 @@ impl ToString for WindowSpec {
277277

278278
/// Specifies the data processed by a window function, e.g.
279279
/// `RANGE UNBOUNDED PRECEDING` or `ROWS BETWEEN 5 PRECEDING AND CURRENT ROW`.
280-
#[derive(Debug, Clone, PartialEq, Hash)]
280+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
281281
pub struct WindowFrame {
282282
pub units: WindowFrameUnits,
283283
pub start_bound: WindowFrameBound,
@@ -286,7 +286,7 @@ pub struct WindowFrame {
286286
// TBD: EXCLUDE
287287
}
288288

289-
#[derive(Debug, Clone, PartialEq, Hash)]
289+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
290290
pub enum WindowFrameUnits {
291291
Rows,
292292
Range,
@@ -319,7 +319,7 @@ impl FromStr for WindowFrameUnits {
319319
}
320320
}
321321

322-
#[derive(Debug, Clone, PartialEq, Hash)]
322+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
323323
pub enum WindowFrameBound {
324324
/// "CURRENT ROW"
325325
CurrentRow,
@@ -344,7 +344,7 @@ impl ToString for WindowFrameBound {
344344

345345
/// A top-level statement (SELECT, INSERT, CREATE, etc.)
346346
#[allow(clippy::large_enum_variant)]
347-
#[derive(Debug, Clone, PartialEq, Hash)]
347+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
348348
pub enum Statement {
349349
/// SELECT
350350
Query(Box<Query>),
@@ -589,7 +589,7 @@ impl ToString for Statement {
589589
}
590590

591591
/// A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
592-
#[derive(Debug, Clone, PartialEq, Hash)]
592+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
593593
pub struct ObjectName(pub Vec<Ident>);
594594

595595
impl ToString for ObjectName {
@@ -599,7 +599,7 @@ impl ToString for ObjectName {
599599
}
600600

601601
/// SQL assignment `foo = expr` as used in SQLUpdate
602-
#[derive(Debug, Clone, PartialEq, Hash)]
602+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
603603
pub struct Assignment {
604604
pub id: Ident,
605605
pub value: Expr,
@@ -612,7 +612,7 @@ impl ToString for Assignment {
612612
}
613613

614614
/// SQL function
615-
#[derive(Debug, Clone, PartialEq, Hash)]
615+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
616616
pub struct Function {
617617
pub name: ObjectName,
618618
pub args: Vec<Expr>,
@@ -637,7 +637,7 @@ impl ToString for Function {
637637
}
638638

639639
/// External table's available file format
640-
#[derive(Debug, Clone, PartialEq, Hash)]
640+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
641641
pub enum FileFormat {
642642
TEXTFILE,
643643
SEQUENCEFILE,
@@ -686,7 +686,7 @@ impl FromStr for FileFormat {
686686
}
687687
}
688688

689-
#[derive(Debug, Clone, PartialEq, Hash)]
689+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
690690
pub enum ObjectType {
691691
Table,
692692
View,
@@ -701,7 +701,7 @@ impl ObjectType {
701701
}
702702
}
703703

704-
#[derive(Debug, Clone, PartialEq, Hash)]
704+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
705705
pub struct SqlOption {
706706
pub name: Ident,
707707
pub value: Value,
@@ -713,7 +713,7 @@ impl ToString for SqlOption {
713713
}
714714
}
715715

716-
#[derive(Debug, Clone, PartialEq, Hash)]
716+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
717717
pub enum TransactionMode {
718718
AccessMode(TransactionAccessMode),
719719
IsolationLevel(TransactionIsolationLevel),
@@ -729,7 +729,7 @@ impl ToString for TransactionMode {
729729
}
730730
}
731731

732-
#[derive(Debug, Clone, PartialEq, Hash)]
732+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
733733
pub enum TransactionAccessMode {
734734
ReadOnly,
735735
ReadWrite,
@@ -745,7 +745,7 @@ impl ToString for TransactionAccessMode {
745745
}
746746
}
747747

748-
#[derive(Debug, Clone, PartialEq, Hash)]
748+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
749749
pub enum TransactionIsolationLevel {
750750
ReadUncommitted,
751751
ReadCommitted,

src/ast/operator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// limitations under the License.
1212

1313
/// Unary operators
14-
#[derive(Debug, Clone, PartialEq, Hash)]
14+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1515
pub enum UnaryOperator {
1616
Plus,
1717
Minus,
@@ -29,7 +29,7 @@ impl ToString for UnaryOperator {
2929
}
3030

3131
/// Binary operators
32-
#[derive(Debug, Clone, PartialEq, Hash)]
32+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3333
pub enum BinaryOperator {
3434
Plus,
3535
Minus,

src/ast/query.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use super::*;
1414

1515
/// The most complete variant of a `SELECT` query expression, optionally
1616
/// including `WITH`, `UNION` / other set operations, and `ORDER BY`.
17-
#[derive(Debug, Clone, PartialEq, Hash)]
17+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1818
pub struct Query {
1919
/// WITH (common table expressions, or CTEs)
2020
pub ctes: Vec<Cte>,
@@ -56,7 +56,7 @@ impl ToString for Query {
5656

5757
/// A node in a tree, representing a "query body" expression, roughly:
5858
/// `SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]`
59-
#[derive(Debug, Clone, PartialEq, Hash)]
59+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6060
pub enum SetExpr {
6161
/// Restricted SELECT .. FROM .. HAVING (no ORDER BY or set operations)
6262
Select(Box<Select>),
@@ -99,7 +99,7 @@ impl ToString for SetExpr {
9999
}
100100
}
101101

102-
#[derive(Debug, Clone, PartialEq, Hash)]
102+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
103103
pub enum SetOperator {
104104
Union,
105105
Except,
@@ -119,7 +119,7 @@ impl ToString for SetOperator {
119119
/// A restricted variant of `SELECT` (without CTEs/`ORDER BY`), which may
120120
/// appear either as the only body item of an `SQLQuery`, or as an operand
121121
/// to a set operation like `UNION`.
122-
#[derive(Debug, Clone, PartialEq, Hash)]
122+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
123123
pub struct Select {
124124
pub distinct: bool,
125125
/// projection expressions
@@ -161,7 +161,7 @@ impl ToString for Select {
161161
/// The names in the column list before `AS`, when specified, replace the names
162162
/// of the columns returned by the query. The parser does not validate that the
163163
/// number of columns in the query matches the number of columns in the query.
164-
#[derive(Debug, Clone, PartialEq, Hash)]
164+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
165165
pub struct Cte {
166166
pub alias: TableAlias,
167167
pub query: Query,
@@ -174,7 +174,7 @@ impl ToString for Cte {
174174
}
175175

176176
/// One item of the comma-separated list following `SELECT`
177-
#[derive(Debug, Clone, PartialEq, Hash)]
177+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
178178
pub enum SelectItem {
179179
/// Any expression, not followed by `[ AS ] alias`
180180
UnnamedExpr(Expr),
@@ -199,7 +199,7 @@ impl ToString for SelectItem {
199199
}
200200
}
201201

202-
#[derive(Debug, Clone, PartialEq, Hash)]
202+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
203203
pub struct TableWithJoins {
204204
pub relation: TableFactor,
205205
pub joins: Vec<Join>,
@@ -216,7 +216,7 @@ impl ToString for TableWithJoins {
216216
}
217217

218218
/// A table name or a parenthesized subquery with an optional alias
219-
#[derive(Debug, Clone, PartialEq, Hash)]
219+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
220220
pub enum TableFactor {
221221
Table {
222222
name: ObjectName,
@@ -283,7 +283,7 @@ impl ToString for TableFactor {
283283
}
284284
}
285285

286-
#[derive(Debug, Clone, PartialEq, Hash)]
286+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
287287
pub struct TableAlias {
288288
pub name: Ident,
289289
pub columns: Vec<Ident>,
@@ -299,7 +299,7 @@ impl ToString for TableAlias {
299299
}
300300
}
301301

302-
#[derive(Debug, Clone, PartialEq, Hash)]
302+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
303303
pub struct Join {
304304
pub relation: TableFactor,
305305
pub join_operator: JoinOperator,
@@ -352,7 +352,7 @@ impl ToString for Join {
352352
}
353353
}
354354

355-
#[derive(Debug, Clone, PartialEq, Hash)]
355+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
356356
pub enum JoinOperator {
357357
Inner(JoinConstraint),
358358
LeftOuter(JoinConstraint),
@@ -365,15 +365,15 @@ pub enum JoinOperator {
365365
OuterApply,
366366
}
367367

368-
#[derive(Debug, Clone, PartialEq, Hash)]
368+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
369369
pub enum JoinConstraint {
370370
On(Expr),
371371
Using(Vec<Ident>),
372372
Natural,
373373
}
374374

375375
/// SQL ORDER BY expression
376-
#[derive(Debug, Clone, PartialEq, Hash)]
376+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
377377
pub struct OrderByExpr {
378378
pub expr: Expr,
379379
pub asc: Option<bool>,
@@ -389,7 +389,7 @@ impl ToString for OrderByExpr {
389389
}
390390
}
391391

392-
#[derive(Debug, Clone, PartialEq, Hash)]
392+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
393393
pub struct Fetch {
394394
pub with_ties: bool,
395395
pub percent: bool,
@@ -413,7 +413,7 @@ impl ToString for Fetch {
413413
}
414414
}
415415

416-
#[derive(Debug, Clone, PartialEq, Hash)]
416+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
417417
pub struct Values(pub Vec<Vec<Expr>>);
418418

419419
impl ToString for Values {

src/ast/value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use ordered_float::OrderedFloat;
1414

1515
/// Primitive SQL values such as number and string
16-
#[derive(Debug, Clone, PartialEq, Hash)]
16+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1717
pub enum Value {
1818
/// Unsigned integer value
1919
Long(u64),
@@ -113,7 +113,7 @@ impl ToString for Value {
113113
}
114114
}
115115

116-
#[derive(Debug, Clone, PartialEq, Hash)]
116+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
117117
pub enum DateTimeField {
118118
Year,
119119
Month,

0 commit comments

Comments
 (0)