Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/248#discussion_r116625014 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java --- @@ -500,8 +510,20 @@ private void init(PName tenantId, PName schemaName, PName tableName, PTableType allColumns = new PColumn[columns.size()]; pkColumns = Lists.newArrayListWithExpectedSize(columns.size()); } - for (PColumn column : columns) { - allColumns[column.getPosition()] = column; + // Must do this as with the new method of storing diffs, we just care about ordinal position + // relative order and not the true ordinal value itself. + List<PColumn> sortedColumns = Lists.newArrayList(columns); + Collections.sort(sortedColumns, new Comparator<PColumn>() { + @Override + public int compare(PColumn o1, PColumn o2) { + return Integer.valueOf(o1.getPosition()).compareTo(o2.getPosition()); --- End diff -- What will prevent overlapping ordinals between a base table and derived views?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---