Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/127#discussion_r44852697 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java --- @@ -1498,30 +1542,61 @@ private PTable createTableInternal(CreateTableStatement statement, byte[][] spli long clientTimeStamp = scn == null ? HConstants.LATEST_TIMESTAMP : scn; boolean multiTenant = false; boolean storeNulls = false; + boolean transactional = false; Integer saltBucketNum = null; String defaultFamilyName = null; boolean isImmutableRows = false; List<PName> physicalNames = Collections.emptyList(); boolean addSaltColumn = false; boolean rowKeyOrderOptimizable = true; + Long timestamp = null; if (parent != null && tableType == PTableType.INDEX) { - // Index on view - // TODO: Can we support a multi-tenant index directly on a multi-tenant - // table instead of only a view? We don't have anywhere to put the link - // from the table to the index, though. - if (indexType == IndexType.LOCAL || (parent.getType() == PTableType.VIEW && parent.getViewType() != ViewType.MAPPED)) { - PName physicalName = parent.getPhysicalName(); - saltBucketNum = parent.getBucketNum(); - addSaltColumn = (saltBucketNum != null && indexType != IndexType.LOCAL); - defaultFamilyName = parent.getDefaultFamilyName() == null ? null : parent.getDefaultFamilyName().getString(); - if (indexType == IndexType.LOCAL) { - saltBucketNum = null; - // Set physical name of local index table - physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getLocalIndexPhysicalName(physicalName.getBytes()))); - } else { - // Set physical name of view index table - physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getViewIndexPhysicalName(physicalName.getBytes()))); + transactional = parent.isTransactional(); + timestamp = TransactionUtil.getTableTimestamp(connection, transactional); + storeNulls = parent.getStoreNulls(); + if (tableType == PTableType.INDEX) { + // Index on view + // TODO: Can we support a multi-tenant index directly on a multi-tenant + // table instead of only a view? We don't have anywhere to put the link + // from the table to the index, though. + if (indexType == IndexType.LOCAL || (parent.getType() == PTableType.VIEW && parent.getViewType() != ViewType.MAPPED)) { + PName physicalName = parent.getPhysicalName(); + saltBucketNum = parent.getBucketNum(); + addSaltColumn = (saltBucketNum != null && indexType != IndexType.LOCAL); + defaultFamilyName = parent.getDefaultFamilyName() == null ? null : parent.getDefaultFamilyName().getString(); + if (indexType == IndexType.LOCAL) { + saltBucketNum = null; + // Set physical name of local index table + physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getLocalIndexPhysicalName(physicalName.getBytes()))); + } else { + // Set physical name of view index table + physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getViewIndexPhysicalName(physicalName.getBytes()))); + } } + --- End diff -- Double check this part of the merge, as this diff looks funny - why'd all these lines get added?
--- 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. ---