ChinmaySKulkarni commented on a change in pull request #908:
URL: https://github.com/apache/phoenix/pull/908#discussion_r506756876



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -3678,6 +3679,34 @@ protected PhoenixConnection 
upgradeSystemCatalogIfRequired(PhoenixConnection met
                 MIN_SYSTEM_TABLE_TIMESTAMP_4_16_0,
                 PhoenixDatabaseMetaData.PHOENIX_TTL_HWM + " "
                         + PInteger.INSTANCE.getSqlTypeName());
+
+            boolean isNamespaceMapping =
+                    SchemaUtil.isNamespaceMappingEnabled(null,  
getConfiguration());
+            String tableName = PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME;
+            if (isNamespaceMapping) {
+                tableName = tableName.replace(
+                        QueryConstants.NAME_SEPARATOR,
+                        QueryConstants.NAMESPACE_SEPARATOR);
+            }
+
+            byte[] rowKey = SchemaUtil.getColumnKey(null,
+                    QueryConstants.SYSTEM_SCHEMA_NAME,
+                    SYSTEM_CATALOG_TABLE, VIEW_INDEX_ID,
+                    PhoenixDatabaseMetaData.TABLE_FAMILY);
+            if 
(UpgradeUtil.isUpdateViewIndexIdColumnDataTypeFromShortToLongNeeded
+                    (metaConnection, rowKey, tableName.getBytes())) {
+                try {
+                    LOGGER.info("Updating VIEW_INDEX_ID data type to BIGINT.");
+                    UpgradeUtil.updateViewIndexIdColumnDataTypeFromShortToLong(
+                            metaConnection, rowKey, tableName.getBytes());
+                    LOGGER.info("Updated VIEW_INDEX_ID data type from SMALLINT 
TO BIGINT.");
+                } catch (Exception e) {
+                    LOGGER.error("Updating VIEW_INDEX_ID data type failed.");

Review comment:
       Change to : `LOGGER.error(" ... ", e)` so we see the actual error too

##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -3678,6 +3679,34 @@ protected PhoenixConnection 
upgradeSystemCatalogIfRequired(PhoenixConnection met
                 MIN_SYSTEM_TABLE_TIMESTAMP_4_16_0,
                 PhoenixDatabaseMetaData.PHOENIX_TTL_HWM + " "
                         + PInteger.INSTANCE.getSqlTypeName());
+
+            boolean isNamespaceMapping =
+                    SchemaUtil.isNamespaceMappingEnabled(null,  
getConfiguration());
+            String tableName = PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME;
+            if (isNamespaceMapping) {
+                tableName = tableName.replace(
+                        QueryConstants.NAME_SEPARATOR,
+                        QueryConstants.NAMESPACE_SEPARATOR);
+            }
+
+            byte[] rowKey = SchemaUtil.getColumnKey(null,
+                    QueryConstants.SYSTEM_SCHEMA_NAME,
+                    SYSTEM_CATALOG_TABLE, VIEW_INDEX_ID,
+                    PhoenixDatabaseMetaData.TABLE_FAMILY);
+            if 
(UpgradeUtil.isUpdateViewIndexIdColumnDataTypeFromShortToLongNeeded
+                    (metaConnection, rowKey, tableName.getBytes())) {
+                try {
+                    LOGGER.info("Updating VIEW_INDEX_ID data type to BIGINT.");
+                    UpgradeUtil.updateViewIndexIdColumnDataTypeFromShortToLong(
+                            metaConnection, rowKey, tableName.getBytes());
+                    LOGGER.info("Updated VIEW_INDEX_ID data type from SMALLINT 
TO BIGINT.");
+                } catch (Exception e) {
+                    LOGGER.error("Updating VIEW_INDEX_ID data type failed.");
+

Review comment:
       nit: Remove extra new line




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


Reply via email to