You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/07/12 20:07:33 UTC

[GitHub] [phoenix] virajjasani commented on a change in pull request #1256: PHOENIX-6458 Using global indexes for queries with uncovered columns

virajjasani commented on a change in pull request #1256:
URL: https://github.com/apache/phoenix/pull/1256#discussion_r667666618



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java
##########
@@ -156,7 +155,7 @@ public static PTable createProjectedTable(SelectStatement select, StatementConte
         }
         // add LocalIndexDataColumnRef

Review comment:
       nit: `IndexDataColumnRef` in place of `LocalIndexDataColumnRef`?

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
##########
@@ -574,20 +575,35 @@ public static void wrapResultUsingOffset(final RegionCoprocessorEnvironment envi
                 }
             }
             Result joinResult = null;
-            if (dataRegion != null) {
-                joinResult = dataRegion.get(get);
-            } else {
-                TableName dataTable =
-                    TableName.valueOf(MetaDataUtil.getLocalIndexUserTableName(environment.getRegion().
-                        getTableDescriptor().getTableName().getNameAsString()));
+            if (ScanUtil.isLocalIndex(scan)) {
+                if (dataRegion != null) {
+                    joinResult = dataRegion.get(get);
+                } else {
+                    TableName dataTable =
+                        TableName.valueOf(MetaDataUtil.getLocalIndexUserTableName(environment.getRegion().
+                            getTableDescriptor().getTableName().getNameAsString()));
+                    Table table = null;
+                    try {
+                        table = environment.getConnection().getTable(dataTable);
+                        joinResult = table.get(get);
+                    } finally {
+                        if (table != null) table.close();
+                    }

Review comment:
       Good to replace with `try-with-resources`?

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
##########
@@ -80,9 +81,15 @@
         "_IndexRebuildDisableLoggingVerifyType";
     public static final String INDEX_REBUILD_DISABLE_LOGGING_BEYOND_MAXLOOKBACK_AGE =
         "_IndexRebuildDisableLoggingBeyondMaxLookbackAge";
+    @Deprecated
     public static final String LOCAL_INDEX_FILTER = "_LocalIndexFilter";
+    @Deprecated
     public static final String LOCAL_INDEX_LIMIT = "_LocalIndexLimit";
+    @Deprecated
     public static final String LOCAL_INDEX_FILTER_STR = "_LocalIndexFilterStr";

Review comment:
       I believe these deprecated fields can be removed only after we come to a major release (e.g 6.x/7.x) where server running on that release can no longer be directly supported by client version <= 4.16/4.17, is that correct?

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java
##########
@@ -1168,8 +1168,8 @@ public ColumnRef resolveColumn(String schemaName, String tableName, String colNa
                 colRef = super.resolveColumn(schemaName, tableName, colName);
             } catch (ColumnNotFoundException e) {
                 // This could be a ColumnRef for local index data column.

Review comment:
       nit: we can remove `local` reference here?

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
##########
@@ -574,20 +575,35 @@ public static void wrapResultUsingOffset(final RegionCoprocessorEnvironment envi
                 }
             }
             Result joinResult = null;
-            if (dataRegion != null) {
-                joinResult = dataRegion.get(get);
-            } else {
-                TableName dataTable =
-                    TableName.valueOf(MetaDataUtil.getLocalIndexUserTableName(environment.getRegion().
-                        getTableDescriptor().getTableName().getNameAsString()));
+            if (ScanUtil.isLocalIndex(scan)) {
+                if (dataRegion != null) {
+                    joinResult = dataRegion.get(get);
+                } else {
+                    TableName dataTable =
+                        TableName.valueOf(MetaDataUtil.getLocalIndexUserTableName(environment.getRegion().
+                            getTableDescriptor().getTableName().getNameAsString()));
+                    Table table = null;
+                    try {
+                        table = environment.getConnection().getTable(dataTable);
+                        joinResult = table.get(get);
+                    } finally {
+                        if (table != null) table.close();
+                    }
+                }
+            } else if (ScanUtil.isGlobalIndex(scan)) {
+                byte[] dataTableName = scan.getAttribute(PHYSICAL_DATA_TABLE_NAME);
                 Table table = null;
                 try {
-                    table = environment.getConnection().getTable(dataTable);
+                    table = ServerUtil.ConnectionFactory.

Review comment:
       Same here reg `try-with-resources`




-- 
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-unsubscribe@phoenix.apache.org

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