-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser): json index operator with alter table (#61)
Turns out `name` is an Option and that `expr` can be a more complicated object rather than just a string. Previously we didn't have any tests that exercised the `expr` property. I think the issues with clippy are related to: rust-lang/rust-clippy#2604 fixes: #59
- Loading branch information
Showing
14 changed files
with
158 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
parser/src/snapshots/squawk_parser__parse__tests__json_index_operator.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
source: parser/src/parse.rs | ||
expression: res | ||
--- | ||
Ok( | ||
[ | ||
RawStmt( | ||
RawStmt { | ||
stmt: IndexStmt( | ||
IndexStmt { | ||
access_method: "btree", | ||
idxname: "idx_a_foo_bar", | ||
index_params: [ | ||
IndexElem( | ||
IndexElem { | ||
name: None, | ||
expr: Some( | ||
Object({ | ||
"A_Expr": Object({ | ||
"kind": Number( | ||
0, | ||
), | ||
"lexpr": Object({ | ||
"ColumnRef": Object({ | ||
"fields": Array([ | ||
Object({ | ||
"String": Object({ | ||
"str": String( | ||
"foo", | ||
), | ||
}), | ||
}), | ||
]), | ||
"location": Number( | ||
66, | ||
), | ||
}), | ||
}), | ||
"location": Number( | ||
69, | ||
), | ||
"name": Array([ | ||
Object({ | ||
"String": Object({ | ||
"str": String( | ||
"->>", | ||
), | ||
}), | ||
}), | ||
]), | ||
"rexpr": Object({ | ||
"A_Const": Object({ | ||
"location": Number( | ||
72, | ||
), | ||
"val": Object({ | ||
"String": Object({ | ||
"str": String( | ||
"bar", | ||
), | ||
}), | ||
}), | ||
}), | ||
}), | ||
}), | ||
}), | ||
), | ||
indexcolname: None, | ||
collation: None, | ||
opclass: [], | ||
ordering: Default, | ||
nulls_ordering: Default, | ||
}, | ||
), | ||
], | ||
relation: RangeVar( | ||
RangeVar { | ||
catalogname: None, | ||
schemaname: None, | ||
relname: "a", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 60, | ||
}, | ||
), | ||
concurrent: true, | ||
unique: false, | ||
primary: false, | ||
isconstraint: false, | ||
deferrable: false, | ||
initdeferred: false, | ||
transformed: false, | ||
if_not_exists: true, | ||
table_space: None, | ||
}, | ||
), | ||
stmt_location: 0, | ||
stmt_len: Some( | ||
79, | ||
), | ||
}, | ||
), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters