Skip to content

Commit 26fd2d4

Browse files
committed
Add DROP PARTITIONED INDEX
1 parent 2516ad4 commit 26fd2d4

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/ast/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -6170,6 +6170,8 @@ pub enum ObjectType {
61706170
Sequence,
61716171
Stage,
61726172
Type,
6173+
// CubeStore extension.
6174+
PartitionedIndex,
61736175
}
61746176

61756177
impl fmt::Display for ObjectType {
@@ -6184,6 +6186,7 @@ impl fmt::Display for ObjectType {
61846186
ObjectType::Sequence => "SEQUENCE",
61856187
ObjectType::Stage => "STAGE",
61866188
ObjectType::Type => "TYPE",
6189+
ObjectType::PartitionedIndex => "PARTITIONED INDEX",
61876190
})
61886191
}
61896192
}

src/parser/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -5551,6 +5551,8 @@ impl<'a> Parser<'a> {
55515551
ObjectType::Schema
55525552
} else if self.parse_keyword(Keyword::DATABASE) {
55535553
ObjectType::Database
5554+
} else if self.parse_keywords(&[Keyword::PARTITIONED, Keyword::INDEX]) {
5555+
ObjectType::PartitionedIndex
55545556
} else if self.parse_keyword(Keyword::SEQUENCE) {
55555557
ObjectType::Sequence
55565558
} else if self.parse_keyword(Keyword::STAGE) {
@@ -5571,7 +5573,7 @@ impl<'a> Parser<'a> {
55715573
return self.parse_drop_extension();
55725574
} else {
55735575
return self.expected(
5574-
"DATABASE, EXTENSION, FUNCTION, INDEX, POLICY, PROCEDURE, ROLE, SCHEMA, SECRET, SEQUENCE, STAGE, TABLE, TRIGGER, TYPE, or VIEW after DROP",
5576+
"DATABASE, EXTENSION, FUNCTION, INDEX, PARTITIONED INDEX, POLICY, PROCEDURE, ROLE, SCHEMA, SECRET, SEQUENCE, STAGE, TABLE, TRIGGER, TYPE, or VIEW after DROP",
55755577
self.peek_token(),
55765578
);
55775579
};

tests/sqlparser_common.rs

+12
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,18 @@ fn parse_drop_schema() {
37643764
}
37653765
}
37663766

3767+
#[test]
3768+
fn parse_drop_partitioned_index() {
3769+
let sql = "DROP PARTITIONED INDEX X";
3770+
3771+
match verified_stmt(sql) {
3772+
Statement::Drop { object_type, .. } => {
3773+
assert_eq!(object_type, ObjectType::PartitionedIndex)
3774+
}
3775+
_ => unreachable!(),
3776+
}
3777+
}
3778+
37673779
#[test]
37683780
fn parse_create_table_as() {
37693781
let sql = "CREATE TABLE t AS SELECT * FROM a";

0 commit comments

Comments
 (0)