swaroopak commented on a change in pull request #516: PHOENIX-5209 Cannot add 
non-PK column to table when the last PK column is of type VARBINARY or ARRAY
URL: https://github.com/apache/phoenix/pull/516#discussion_r291844528
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 ##########
 @@ -3593,10 +3593,11 @@ public MutationState addColumn(PTable table, 
List<ColumnDef> origColumnDefs,
 
                 int position = table.getColumns().size();
 
-                List<PColumn> currentPKs = table.getPKColumns();
-                if (numCols > 0) {
+                boolean addPKColumns = 
columnDefs.stream().anyMatch(ColumnDef::isPK);
+                if (addPKColumns) {
+                    List<PColumn> currentPKs = table.getPKColumns();
                     PColumn lastPK = currentPKs.get(currentPKs.size()-1);
-                    // Disallow adding columns if the last column is VARBIANRY.
+                    // Disallow adding columns if the last column is VARBIANRY 
or ARRAY.
 
 Review comment:
   (unrelated to this PR) nit: last column in the primary key.

----------------------------------------------------------------
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