Skip to content

Commit dcc51a6

Browse files
committed
Add DROP PARTITIONED INDEX
1 parent e6e90af commit dcc51a6

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/ast/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,8 @@ pub enum ObjectType {
14641464
View,
14651465
Index,
14661466
Schema,
1467+
// CubeStore extension.
1468+
PartitionedIndex,
14671469
}
14681470

14691471
impl fmt::Display for ObjectType {
@@ -1473,6 +1475,7 @@ impl fmt::Display for ObjectType {
14731475
ObjectType::View => "VIEW",
14741476
ObjectType::Index => "INDEX",
14751477
ObjectType::Schema => "SCHEMA",
1478+
ObjectType::PartitionedIndex => "PARTITIONED INDEX",
14761479
})
14771480
}
14781481
}

src/parser.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,13 @@ impl<'a> Parser<'a> {
14131413
ObjectType::Index
14141414
} else if self.parse_keyword(Keyword::SCHEMA) {
14151415
ObjectType::Schema
1416+
} else if self.parse_keywords(&[Keyword::PARTITIONED, Keyword::INDEX]) {
1417+
ObjectType::PartitionedIndex
14161418
} else {
1417-
return self.expected("TABLE, VIEW, INDEX or SCHEMA after DROP", self.peek_token());
1419+
return self.expected(
1420+
"TABLE, VIEW, INDEX, PARTITIONED INDEX or SCHEMA after DROP",
1421+
self.peek_token(),
1422+
);
14181423
};
14191424
// Many dialects support the non standard `IF EXISTS` clause and allow
14201425
// specifying multiple objects to delete in a single statement

tests/sqlparser_common.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,18 @@ fn parse_drop_schema() {
13411341
}
13421342
}
13431343

1344+
#[test]
1345+
fn parse_drop_partitioned_index() {
1346+
let sql = "DROP PARTITIONED INDEX X";
1347+
1348+
match verified_stmt(sql) {
1349+
Statement::Drop { object_type, .. } => {
1350+
assert_eq!(object_type, ObjectType::PartitionedIndex)
1351+
}
1352+
_ => unreachable!(),
1353+
}
1354+
}
1355+
13441356
#[test]
13451357
fn parse_create_table_as() {
13461358
let sql = "CREATE TABLE t AS SELECT * FROM a";

0 commit comments

Comments
 (0)