djanand commented on a change in pull request #1422:
URL: https://github.com/apache/cassandra/pull/1422#discussion_r828811759
##########
File path: src/antlr/Parser.g
##########
@@ -961,28 +969,33 @@ isStaticColumn returns [boolean isStaticColumn]
alterMaterializedViewStatement returns [AlterViewStatement.Raw stmt]
@init {
TableAttributes attrs = new TableAttributes();
+ boolean ifExists = false;
}
- : K_ALTER K_MATERIALIZED K_VIEW name=columnFamilyName
+ : K_ALTER K_MATERIALIZED K_VIEW (K_IF K_EXISTS { ifExists = true; } )?
name=columnFamilyName
K_WITH properties[attrs]
{
- $stmt = new AlterViewStatement.Raw(name, attrs);
+ $stmt = new AlterViewStatement.Raw(name, attrs, ifExists);
}
;
/**
- * ALTER TYPE <name> ALTER <field> TYPE <newtype>;
- * ALTER TYPE <name> ADD <field> <newtype>;
- * ALTER TYPE <name> RENAME <field> TO <newtype> AND ...;
+ * ALTER TYPE [IF EXISTS] <name> ALTER <field> TYPE <newtype>;
+ * ALTER TYPE [IF EXISTS] <name> ADD [IF NOT EXISTS]<field> <newtype>;
+ * ALTER TYPE [IF EXISTS] <name> RENAME [IF EXISTS] <field> TO <newtype> AND
...;
*/
alterTypeStatement returns [AlterTypeStatement.Raw stmt]
- : K_ALTER K_TYPE name=userTypeName { $stmt = new
AlterTypeStatement.Raw(name); }
+ @init {
+ boolean ifExists = false;
+ boolean ifNotExists = false;
Review comment:
thanks for keeping a close 👀 . That's right, it wasn't being used.
Removed and ran tests as well. Looks good
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]