Skip to content

Commit 3c8421d

Browse files
authored
Merge pull request #451 from kitta65/feature/issue-430
Feature/issue 430
2 parents 37bed8d + 9c22db0 commit 3c8421d

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/parser.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,10 @@ impl Parser {
20252025
// ----- DDL -----
20262026
fn parse_create_schema_statement(&mut self, semicolon: bool) -> BQ2CSTResult<Node> {
20272027
let mut create = self.construct_node(NodeType::CreateSchemaStatement)?;
2028+
if self.get_token(1)?.is("EXTERNAL") {
2029+
self.next_token()?; // -> EXTERNAL
2030+
create.push_node("external", self.construct_node(NodeType::Keyword)?);
2031+
}
20282032
self.next_token()?; // -> SCHEMA
20292033
create.push_node("what", self.construct_node(NodeType::Keyword)?);
20302034
if self.get_token(1)?.is("IF") {
@@ -2047,6 +2051,10 @@ impl Parser {
20472051
default.push_node("next_keyword", collate);
20482052
create.push_node("default_collate", default);
20492053
}
2054+
if self.get_token(1)?.is("WITH") && self.get_token(2)?.is("CONNECTION") {
2055+
self.next_token()?; // -> WITH
2056+
create.push_node("with_connection", self.parse_with_connection_clause()?);
2057+
}
20502058
if self.get_token(1)?.is("OPTIONS") {
20512059
self.next_token()?; // OPTIONS
20522060
create.push_node("options", self.parse_keyword_with_grouped_exprs(false)?);

src/parser/tests/tests_ddl.rs

+22
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ ident:
7171
self: dataset_name (Identifier)
7272
what:
7373
self: SCHEMA (Keyword)
74+
",
75+
0,
76+
)),
77+
Box::new(SuccessTestCase::new(
78+
"\
79+
CREATE EXTERNAL SCHEMA dataset_name
80+
WITH CONNECTION connection_name
81+
",
82+
"\
83+
self: CREATE (CreateSchemaStatement)
84+
external:
85+
self: EXTERNAL (Keyword)
86+
ident:
87+
self: dataset_name (Identifier)
88+
what:
89+
self: SCHEMA (Keyword)
90+
with_connection:
91+
self: WITH (KeywordSequence)
92+
next_keyword:
93+
self: CONNECTION (KeywordWithExpr)
94+
expr:
95+
self: connection_name (Identifier)
7496
",
7597
0,
7698
)),

src/types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,12 @@ export type CreateRowAccessPolicyStatement = XXXStatement & {
649649
export type CreateSchemaStatement = XXXStatement & {
650650
node_type: "CreateSchemaStatement";
651651
children: {
652+
external?: NodeChild;
652653
what: NodeChild;
653654
if_not_exists?: NodeVecChild;
654655
ident: NodeChild;
655656
default_collate: NodeChild;
657+
with_connection?: NodeChild;
656658
options?: NodeChild;
657659
};
658660
};

0 commit comments

Comments
 (0)