virajjasani commented on code in PR #2060:
URL: https://github.com/apache/phoenix/pull/2060#discussion_r1936374592


##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTableImpl.java:
##########
@@ -2516,6 +2479,41 @@ public Map<PTableKey, Long> 
getAncestorLastDDLTimestampMap() {
         return ancestorLastDDLTimestampMap;
     }
 
+    private static PColumn getCompatibleColumnTypeForClientVersion(PColumn 
column, String schemaName, String tableName, String columnName, long 
clientVersion) {
+        LOGGER.info("getCompatibleColumnTypeForVersion for column Name {}.{}, 
{}, version{} ",schemaName, tableName, columnName, clientVersion);
+        if 
((column.getName().getString().equalsIgnoreCase(PhoenixDatabaseMetaData.ROW_KEY_MATCHER
 )
+                || 
column.getName().getString().equalsIgnoreCase(PhoenixDatabaseMetaData.PARTITION_START_KEY)
+                || 
column.getName().getString().equalsIgnoreCase(PhoenixDatabaseMetaData.PARTITION_END_KEY))
+                && clientVersion < 
MetaDataProtocol.MIN_VERSION_ALLOW_VBE_COLUMNS) {
+            PColumn backwardCompatibleColumn =
+                    new PColumnImpl(column.getName(),
+                            column.getFamilyName(),
+                            PVarbinary.INSTANCE,
+                            column.getMaxLength(),
+                            column.getScale(),
+                            column.isNullable(),
+                            column.getPosition(),
+                            column.getSortOrder(),
+                            column.getArraySize(),
+                            column.getViewConstant(),
+                            column.isViewReferenced(),
+                            column.getExpressionStr(),
+                            column.isRowTimestamp(),
+                            column.isDynamic(),
+                            column.getColumnQualifierBytes(),
+                            column.getTimestamp());
+
+            LOGGER.info("Adapting field type to {} from {}, MIN_CATALOG_TS {}, 
CLIENT_VERSION {}, MIN_ALLOWED_VERSION {}",
+                    backwardCompatibleColumn.getDataType().getSqlTypeName(),
+                    column.getDataType().getSqlTypeName(),
+                    MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP,
+                    clientVersion,
+                    MetaDataProtocol.MIN_VERSION_ALLOW_VBE_COLUMNS);
+            return backwardCompatibleColumn;

Review Comment:
   Instead of returning VARBINARY column for ROW_KEY_MATCHER, can't we return 
null here i.e. no column?



-- 
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: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to