You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2019/05/17 05:32:30 UTC

[GitHub] [phoenix] priyankporwal commented on a change in pull request #508: PHOENIX-5283: Add CASCADE INDEX ALL in the SQL Grammar of ALTER TABLE…

priyankporwal commented on a change in pull request #508: PHOENIX-5283: Add CASCADE INDEX ALL in the SQL Grammar of ALTER TABLE…
URL: https://github.com/apache/phoenix/pull/508#discussion_r284982139
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 ##########
 @@ -3524,14 +3525,20 @@ private void mutateStringProperty(String tenantId, String schemaName, String tab
 
     public MutationState addColumn(AddColumnStatement statement) throws SQLException {
         PTable table = FromCompiler.getResolver(statement, connection).getTables().get(0).getTable();
-        return addColumn(table, statement.getColumnDefs(), statement.getProps(), statement.ifNotExists(), false, statement.getTable(), statement.getTableType());
+        return addColumn(table, statement.getColumnDefs(), statement.getProps(), statement.ifNotExists(), false, statement.getTable(), statement.getTableType(), statement.isCascade(), statement.getIndexes());
     }
 
     public MutationState addColumn(PTable table, List<ColumnDef> origColumnDefs,
             ListMultimap<String, Pair<String, Object>> stmtProperties, boolean ifNotExists,
-            boolean removeTableProps, NamedTableNode namedTableNode, PTableType tableType)
+            boolean removeTableProps, NamedTableNode namedTableNode, PTableType tableType, boolean cascade, List<NamedNode> indexes)
                     throws SQLException {
         connection.rollback();
+        if(cascade || indexes == null || indexes.size()>0) {
 
 Review comment:
   Hmmm, when cascade is false and indexes is null, this shouldn't throw the exception on line 3540 - perhaps a no-op [i.e. treat as indexes.size() == 0] or maybe throw an exception saying something like 'CASCADE without indexes is needless'.
   Also, when cascade is false, but indexes has something, there should perhaps be another exception, such as 'invalid argument/statement'. Unsure, how that would be - but assume someone bypassed grammar checks. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services