@@ -8893,38 +8893,15 @@ impl<'a> Parser<'a> {
88938893 Keyword::ROLE,
88948894 Keyword::POLICY,
88958895 Keyword::CONNECTOR,
8896+ Keyword::ICEBERG,
88968897 ])?;
88978898 match object_type {
88988899 Keyword::VIEW => self.parse_alter_view(),
88998900 Keyword::TYPE => self.parse_alter_type(),
8900- Keyword::TABLE => {
8901- let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
8902- let only = self.parse_keyword(Keyword::ONLY); // [ ONLY ]
8903- let table_name = self.parse_object_name(false)?;
8904- let on_cluster = self.parse_optional_on_cluster()?;
8905- let operations = self.parse_comma_separated(Parser::parse_alter_table_operation)?;
8906-
8907- let mut location = None;
8908- if self.parse_keyword(Keyword::LOCATION) {
8909- location = Some(HiveSetLocation {
8910- has_set: false,
8911- location: self.parse_identifier()?,
8912- });
8913- } else if self.parse_keywords(&[Keyword::SET, Keyword::LOCATION]) {
8914- location = Some(HiveSetLocation {
8915- has_set: true,
8916- location: self.parse_identifier()?,
8917- });
8918- }
8919-
8920- Ok(Statement::AlterTable {
8921- name: table_name,
8922- if_exists,
8923- only,
8924- operations,
8925- location,
8926- on_cluster,
8927- })
8901+ Keyword::TABLE => self.parse_alter_table(false),
8902+ Keyword::ICEBERG => {
8903+ self.expect_keyword(Keyword::TABLE)?;
8904+ self.parse_alter_table(true)
89288905 }
89298906 Keyword::INDEX => {
89308907 let index_name = self.parse_object_name(false)?;
@@ -8952,6 +8929,38 @@ impl<'a> Parser<'a> {
89528929 }
89538930 }
89548931
8932+ /// Parse a [Statement::AlterTable]
8933+ pub fn parse_alter_table(&mut self, iceberg: bool) -> Result<Statement, ParserError> {
8934+ let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
8935+ let only = self.parse_keyword(Keyword::ONLY); // [ ONLY ]
8936+ let table_name = self.parse_object_name(false)?;
8937+ let on_cluster = self.parse_optional_on_cluster()?;
8938+ let operations = self.parse_comma_separated(Parser::parse_alter_table_operation)?;
8939+
8940+ let mut location = None;
8941+ if self.parse_keyword(Keyword::LOCATION) {
8942+ location = Some(HiveSetLocation {
8943+ has_set: false,
8944+ location: self.parse_identifier()?,
8945+ });
8946+ } else if self.parse_keywords(&[Keyword::SET, Keyword::LOCATION]) {
8947+ location = Some(HiveSetLocation {
8948+ has_set: true,
8949+ location: self.parse_identifier()?,
8950+ });
8951+ }
8952+
8953+ Ok(Statement::AlterTable {
8954+ name: table_name,
8955+ if_exists,
8956+ only,
8957+ operations,
8958+ location,
8959+ on_cluster,
8960+ iceberg,
8961+ })
8962+ }
8963+
89558964 pub fn parse_alter_view(&mut self) -> Result<Statement, ParserError> {
89568965 let name = self.parse_object_name(false)?;
89578966 let columns = self.parse_parenthesized_column_list(Optional, false)?;
0 commit comments