[ 
https://issues.apache.org/jira/browse/PHOENIX-6227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17438200#comment-17438200
 ] 

ASF GitHub Bot commented on PHOENIX-6227:
-----------------------------------------

gjacoby126 commented on a change in pull request #1341:
URL: https://github.com/apache/phoenix/pull/1341#discussion_r742156903



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
##########
@@ -1148,115 +1235,203 @@ private PTable getTable(RegionScanner scanner, long 
clientTimeStamp, long tableT
                             transactionProviderKv.getValueOffset(),
                             SortOrder.getDefault()));
         }
+        builder.setTransactionProvider(transactionProviderKv != null || 
transactionalKv != null
+            ? transactionProvider : oldTable != null ? 
oldTable.getTransactionProvider() : null);
+
         Cell viewTypeKv = tableKeyValues[VIEW_TYPE_INDEX];
         ViewType viewType = viewTypeKv == null ? null : 
ViewType.fromSerializedValue(viewTypeKv.getValueArray()[viewTypeKv.getValueOffset()]);
-        PDataType viewIndexIdType = getViewIndexIdType(tableKeyValues);
+        builder.setViewType(viewType != null ? viewType : oldTable != null ? 
oldTable.getViewType() : null);
+
+        PDataType viewIndexIdType = oldTable != null ? 
oldTable.getviewIndexIdType() :
+            getViewIndexIdType(tableKeyValues);
+        builder.setViewIndexIdType(viewIndexIdType);
+
         Long viewIndexId = getViewIndexId(tableKeyValues, viewIndexIdType);
+        builder.setViewIndexId(viewIndexId != null ? viewIndexId : oldTable != 
null ? oldTable.getViewIndexId() : null);
+
         Cell indexTypeKv = tableKeyValues[INDEX_TYPE_INDEX];
         IndexType indexType = indexTypeKv == null ? null : 
IndexType.fromSerializedValue(indexTypeKv.getValueArray()[indexTypeKv.getValueOffset()]);
+        builder.setIndexType(indexType != null ? indexType : oldTable != null 
? oldTable.getIndexType() : null);
+
         Cell baseColumnCountKv = tableKeyValues[BASE_COLUMN_COUNT_INDEX];
         int baseColumnCount = baseColumnCountKv == null ? 0 : 
PInteger.INSTANCE.getCodec().decodeInt(baseColumnCountKv.getValueArray(),
                 baseColumnCountKv.getValueOffset(), SortOrder.getDefault());
+        builder.setBaseColumnCount(baseColumnCountKv != null ? baseColumnCount 
: oldTable != null ? oldTable.getBaseColumnCount() : 0);
+
         Cell rowKeyOrderOptimizableKv = 
tableKeyValues[ROW_KEY_ORDER_OPTIMIZABLE_INDEX];
-        boolean rowKeyOrderOptimizable = rowKeyOrderOptimizableKv == null ? 
false : 
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(rowKeyOrderOptimizableKv.getValueArray(),
 rowKeyOrderOptimizableKv.getValueOffset(), 
rowKeyOrderOptimizableKv.getValueLength()));
+        boolean rowKeyOrderOptimizable = rowKeyOrderOptimizableKv != null && 
Boolean.TRUE.equals(
+            
PBoolean.INSTANCE.toObject(rowKeyOrderOptimizableKv.getValueArray(),
+                rowKeyOrderOptimizableKv.getValueOffset(),
+                rowKeyOrderOptimizableKv.getValueLength()));
+        builder.setRowKeyOrderOptimizable(rowKeyOrderOptimizableKv != null ? 
rowKeyOrderOptimizable :
+            oldTable != null && oldTable.rowKeyOrderOptimizable());
+
         Cell updateCacheFrequencyKv = 
tableKeyValues[UPDATE_CACHE_FREQUENCY_INDEX];
         long updateCacheFrequency = updateCacheFrequencyKv == null ? 0 :
                 
PLong.INSTANCE.getCodec().decodeLong(updateCacheFrequencyKv.getValueArray(),
                         updateCacheFrequencyKv.getValueOffset(), 
SortOrder.getDefault());
+        builder.setUpdateCacheFrequency(updateCacheFrequencyKv != null ? 
updateCacheFrequency : oldTable != null ? oldTable.getUpdateCacheFrequency() : 
0);
 
         // Check the cell tag to see whether the view has modified this 
property
         final byte[] tagUpdateCacheFreq = (updateCacheFrequencyKv == null) ?
                 HConstants.EMPTY_BYTE_ARRAY : 
CellUtil.getTagArray(updateCacheFrequencyKv);
         boolean viewModifiedUpdateCacheFrequency = 
(PTableType.VIEW.equals(tableType)) &&
                 Bytes.contains(tagUpdateCacheFreq, 
VIEW_MODIFIED_PROPERTY_BYTES);
+        
builder.setViewModifiedUpdateCacheFrequency(!Bytes.equals(tagUpdateCacheFreq,
+            HConstants.EMPTY_BYTE_ARRAY) ? viewModifiedUpdateCacheFrequency :
+            oldTable != null && 
oldTable.hasViewModifiedUpdateCacheFrequency());
+
         Cell indexDisableTimestampKv = tableKeyValues[INDEX_DISABLE_TIMESTAMP];
         long indexDisableTimestamp = indexDisableTimestampKv == null ? 0L : 
PLong.INSTANCE.getCodec().decodeLong(indexDisableTimestampKv.getValueArray(),
                 indexDisableTimestampKv.getValueOffset(), 
SortOrder.getDefault());
+        builder.setIndexDisableTimestamp(indexDisableTimestampKv != null ?
+            indexDisableTimestamp : oldTable != null ? 
oldTable.getIndexDisableTimestamp() : 0L);
+
         Cell isNamespaceMappedKv = tableKeyValues[IS_NAMESPACE_MAPPED_INDEX];
-        boolean isNamespaceMapped = isNamespaceMappedKv == null ? false
-                : 
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(isNamespaceMappedKv.getValueArray(),
+        boolean isNamespaceMapped = isNamespaceMappedKv != null && 
Boolean.TRUE.equals(
+            PBoolean.INSTANCE.toObject(isNamespaceMappedKv.getValueArray(),
                 isNamespaceMappedKv.getValueOffset(), 
isNamespaceMappedKv.getValueLength()));
+        builder.setNamespaceMapped(isNamespaceMappedKv != null ? 
isNamespaceMapped :
+            oldTable != null && oldTable.isNamespaceMapped());
+
         Cell autoPartitionSeqKv = tableKeyValues[AUTO_PARTITION_SEQ_INDEX];
         String autoPartitionSeq = autoPartitionSeqKv != null ? (String) 
PVarchar.INSTANCE.toObject(autoPartitionSeqKv.getValueArray(), 
autoPartitionSeqKv.getValueOffset(),
                 autoPartitionSeqKv.getValueLength()) : null;
+        builder.setAutoPartitionSeqName(autoPartitionSeq != null
+            ? autoPartitionSeq : oldTable != null ? 
oldTable.getAutoPartitionSeqName() : null);
+
         Cell isAppendOnlySchemaKv = tableKeyValues[APPEND_ONLY_SCHEMA_INDEX];
-        boolean isAppendOnlySchema = isAppendOnlySchemaKv == null ? false
-                : 
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(isAppendOnlySchemaKv.getValueArray(),
+        boolean isAppendOnlySchema = isAppendOnlySchemaKv != null && 
Boolean.TRUE.equals(
+            PBoolean.INSTANCE.toObject(isAppendOnlySchemaKv.getValueArray(),
                 isAppendOnlySchemaKv.getValueOffset(), 
isAppendOnlySchemaKv.getValueLength()));
+        builder.setAppendOnlySchema(isAppendOnlySchemaKv != null ? 
isAppendOnlySchema :
+            oldTable != null && oldTable.isAppendOnlySchema());
+
         Cell storageSchemeKv = tableKeyValues[STORAGE_SCHEME_INDEX];
         //TODO: change this once we start having other values for storage 
schemes
         ImmutableStorageScheme storageScheme = storageSchemeKv == null ? 
ImmutableStorageScheme.ONE_CELL_PER_COLUMN : ImmutableStorageScheme
                 .fromSerializedValue((byte) 
PTinyint.INSTANCE.toObject(storageSchemeKv.getValueArray(),
                         storageSchemeKv.getValueOffset(), 
storageSchemeKv.getValueLength()));
+        builder.setImmutableStorageScheme(storageSchemeKv != null ? 
storageScheme :
+            oldTable != null ? oldTable.getImmutableStorageScheme() : 
ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
+
         Cell encodingSchemeKv = 
tableKeyValues[QUALIFIER_ENCODING_SCHEME_INDEX];
         QualifierEncodingScheme encodingScheme = encodingSchemeKv == null ? 
QualifierEncodingScheme.NON_ENCODED_QUALIFIERS : QualifierEncodingScheme
                 .fromSerializedValue((byte) 
PTinyint.INSTANCE.toObject(encodingSchemeKv.getValueArray(),
                         encodingSchemeKv.getValueOffset(), 
encodingSchemeKv.getValueLength()));
+        builder.setQualifierEncodingScheme(encodingSchemeKv != null ? 
encodingScheme :
+            oldTable != null ? oldTable.getEncodingScheme() : 
QualifierEncodingScheme.NON_ENCODED_QUALIFIERS);
+
         Cell useStatsForParallelizationKv = 
tableKeyValues[USE_STATS_FOR_PARALLELIZATION_INDEX];
-        Boolean useStatsForParallelization = useStatsForParallelizationKv == 
null ? null : 
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(useStatsForParallelizationKv.getValueArray(),
 useStatsForParallelizationKv.getValueOffset(), 
useStatsForParallelizationKv.getValueLength()));
+        Boolean useStatsForParallelization = useStatsForParallelizationKv == 
null ? null :
+            
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(useStatsForParallelizationKv.getValueArray(),
 useStatsForParallelizationKv.getValueOffset(), 
useStatsForParallelizationKv.getValueLength()));
+         builder.setUseStatsForParallelization(useStatsForParallelization != 
null ?
+             useStatsForParallelization : oldTable != null ? 
oldTable.useStatsForParallelization() : null);
 
         Cell phoenixTTLKv = tableKeyValues[PHOENIX_TTL_INDEX];
         long phoenixTTL = phoenixTTLKv == null ? PHOENIX_TTL_NOT_DEFINED :
                 
PLong.INSTANCE.getCodec().decodeLong(phoenixTTLKv.getValueArray(),
                         phoenixTTLKv.getValueOffset(), SortOrder.getDefault());
+        builder.setPhoenixTTL(phoenixTTLKv != null ? phoenixTTL :
+            oldTable != null ? oldTable.getPhoenixTTL() : 
PHOENIX_TTL_NOT_DEFINED);
 
         Cell phoenixTTLHWMKv = tableKeyValues[PHOENIX_TTL_HWM_INDEX];
         long phoenixTTLHWM = phoenixTTLHWMKv == null ? MIN_PHOENIX_TTL_HWM :
                 
PLong.INSTANCE.getCodec().decodeLong(phoenixTTLHWMKv.getValueArray(),
                         phoenixTTLHWMKv.getValueOffset(), 
SortOrder.getDefault());
+        builder.setPhoenixTTLHighWaterMark(phoenixTTLHWMKv != null ? 
phoenixTTLHWM :
+            oldTable != null ? oldTable.getPhoenixTTLHighWaterMark() : 
MIN_PHOENIX_TTL_HWM);
 
         // Check the cell tag to see whether the view has modified this 
property
         final byte[] tagPhoenixTTL = (phoenixTTLKv == null) ?
                 HConstants.EMPTY_BYTE_ARRAY : 
CellUtil.getTagArray(phoenixTTLKv);
         boolean viewModifiedPhoenixTTL = (PTableType.VIEW.equals(tableType)) &&
                 Bytes.contains(tagPhoenixTTL, VIEW_MODIFIED_PROPERTY_BYTES);
+        builder.setViewModifiedPhoenixTTL(oldTable != null ?
+            oldTable.hasViewModifiedPhoenixTTL() || viewModifiedPhoenixTTL : 
viewModifiedPhoenixTTL);
 
         Cell lastDDLTimestampKv = tableKeyValues[LAST_DDL_TIMESTAMP_INDEX];
         Long lastDDLTimestamp = lastDDLTimestampKv == null ?
            null : 
PLong.INSTANCE.getCodec().decodeLong(lastDDLTimestampKv.getValueArray(),
                 lastDDLTimestampKv.getValueOffset(), SortOrder.getDefault());
+        builder.setLastDDLTimestamp(lastDDLTimestampKv != null ? 
lastDDLTimestamp :
+            oldTable != null ? oldTable.getLastDDLTimestamp() : null);
 
         Cell changeDetectionEnabledKv = 
tableKeyValues[CHANGE_DETECTION_ENABLED_INDEX];
         boolean isChangeDetectionEnabled = changeDetectionEnabledKv != null
             && 
Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(changeDetectionEnabledKv.getValueArray(),
             changeDetectionEnabledKv.getValueOffset(),
             changeDetectionEnabledKv.getValueLength()));
+        builder.setIsChangeDetectionEnabled(changeDetectionEnabledKv != null ?
+            isChangeDetectionEnabled : oldTable != null && 
oldTable.isChangeDetectionEnabled());
 
         Cell schemaVersionKv = tableKeyValues[SCHEMA_VERSION_INDEX];
         String schemaVersion = schemaVersionKv != null ? (String) 
PVarchar.INSTANCE.toObject(
                 schemaVersionKv.getValueArray(), 
schemaVersionKv.getValueOffset(), schemaVersionKv.getValueLength())
                 : null;
+        builder.setSchemaVersion(schemaVersion != null ?
+            schemaVersion : oldTable != null ? oldTable.getSchemaVersion() : 
null);
+
+        Cell externalSchemaIdKv = tableKeyValues[EXTERNAL_SCHEMA_ID_INDEX];
+        String externalSchemaId = externalSchemaIdKv != null ?
+            (String) 
PVarchar.INSTANCE.toObject(externalSchemaIdKv.getValueArray(),
+                externalSchemaIdKv.getValueOffset(), 
externalSchemaIdKv.getValueLength())
+            : null;
+        builder.setExternalSchemaId(externalSchemaId != null ? 
externalSchemaId :
+            oldTable != null ? oldTable.getExternalSchemaId() : null);
 
         // Check the cell tag to see whether the view has modified this 
property
         final byte[] tagUseStatsForParallelization = 
(useStatsForParallelizationKv == null) ?
                 HConstants.EMPTY_BYTE_ARRAY : 
CellUtil.getTagArray(useStatsForParallelizationKv);
         boolean viewModifiedUseStatsForParallelization = 
(PTableType.VIEW.equals(tableType)) &&
                 Bytes.contains(tagUseStatsForParallelization, 
VIEW_MODIFIED_PROPERTY_BYTES);
+        
builder.setViewModifiedUseStatsForParallelization(viewModifiedUseStatsForParallelization
 ||
+            (oldTable != null && 
oldTable.hasViewModifiedUseStatsForParallelization()));
 
+        boolean setPhysicalName = false;

Review comment:
       Added a test to LogicalTableNameIT




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Option for DDL changes to export to external schema repository
> --------------------------------------------------------------
>
>                 Key: PHOENIX-6227
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6227
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Geoffrey Jacoby
>            Assignee: Geoffrey Jacoby
>            Priority: Major
>             Fix For: 4.17.0, 5.2.0
>
>
> When a user creates or drops a table or view, or adds/removes a column from 
> one, there should be the option for Phoenix to notify an external schema 
> repository. This should be a configurable plugin so that core Phoenix is not 
> coupled to any particular repository implementation. 
> This will also store a schema id generated by the external schema registry in 
> a new field in System.Catalog so that a future JIRA can switch to using the 
> schema id in change detection WAL annotations. Because of this this JIRA will 
> not be able to be backported to 5.1.x or 4.16.x



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to