Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Dairyo Sekine committed Dec 29, 2023
1 parent f7d48b9 commit 759b67d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/cst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub enum NodeType {
ForSystemTimeAsOfClause, // FOR SYSTEM_TIME AS OF ts
ForStatement,
GrantStatement,
GroupByExprs,
GroupedIdentWithOptions, // (col OPTIONS())
GroupedExpr, // (1)
GroupedExprs, // (1, 2, 3)
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ impl Parser {
// GROUP BY
if self.get_token(1)?.is("GROUP") {
self.next_token()?; // expr -> GROUP
let mut groupby = self.construct_node(NodeType::XXXByExprs)?;
let mut groupby = self.construct_node(NodeType::GroupByExprs)?;
self.next_token()?; // GROUP -> BY
groupby.push_node("by", self.construct_node(NodeType::Keyword)?);
if self.get_token(1)?.in_(&vec!["ROLLUP", "CUBE"]) {
Expand Down
8 changes: 4 additions & 4 deletions src/parser/tests/tests_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,7 @@ from:
expr:
self: t (Identifier)
groupby:
self: GROUP (XXXByExprs)
self: GROUP (GroupByExprs)
by:
self: BY (Keyword)
exprs:
Expand Down Expand Up @@ -2084,7 +2084,7 @@ from:
expr:
self: t (Identifier)
groupby:
self: GROUP (XXXByExprs)
self: GROUP (GroupByExprs)
by:
self: BY (Keyword)
exprs:
Expand Down Expand Up @@ -2118,7 +2118,7 @@ from:
expr:
self: t (Identifier)
groupby:
self: GROUP (XXXByExprs)
self: GROUP (GroupByExprs)
by:
self: BY (Keyword)
exprs:
Expand Down Expand Up @@ -2167,7 +2167,7 @@ from:
expr:
self: t (Identifier)
groupby:
self: GROUP (XXXByExprs)
self: GROUP (GroupByExprs)
by:
self: BY (Keyword)
exprs:
Expand Down
11 changes: 11 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type UnknownNode =
| ForStatement
| ForSystemTimeAsOfClause
| GrantStatement
| GroupByExprs
| GroupedExpr
| GroupedExprs
| GroupedIdentWithOptions
Expand Down Expand Up @@ -810,6 +811,16 @@ export type GrantStatement = XXXStatement & {
};
};
export type GroupByExprs = BaseNode & {
token: Token;
node_type: "GroupByExprs";
children: {
by: NodeChild;
how?: NodeVecChild;
exprs: { NodeVec: Expr[] & UnknownNode[] };
};
};
export type GroupedExpr = FromItemExpr & {
node_type: "GroupedExpr";
children: {
Expand Down

1 comment on commit 759b67d

@kitta65
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.