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_r285676669
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 ##########
 @@ -3524,14 +3525,26 @@ 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:
   The condition (indexes==null || indexes.size()>0) seems very un-intuitive. 
It requires folks to understand that indexes==null is the case with ALL and the 
latter is when there is explicit list of indexes; which is not very clear just 
reading this code. 
   I'd just remove this condition entirely for now. It is not relevant for the 
throwing NOT_SUPPORTED_CASCADE_FEATURE exception for views. And indexes should 
be properly handled when the feature is implemented.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to