gokceni commented on a change in pull request #1256:
URL: https://github.com/apache/phoenix/pull/1256#discussion_r812468025
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
##########
@@ -576,20 +597,27 @@ 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()));
- Table table = null;
- try {
- table = environment.getConnection().getTable(dataTable);
+ if (ScanUtil.isLocalIndex(scan)) {
+ if (dataRegion != null) {
+ joinResult = dataRegion.get(get);
+ } else {
+ TableName dataTable =
+
TableName.valueOf(MetaDataUtil.getLocalIndexUserTableName(
+
environment.getRegion().getTableDescriptor().getTableName().
+ getNameAsString()));
+ try (Table table =
environment.getConnection().getTable(dataTable)) {
+ joinResult = table.get(get);
+ }
+ }
+ } else if (ScanUtil.isUncoveredGlobalIndex(scan)) {
+ byte[] dataTableName =
scan.getAttribute(PHYSICAL_DATA_TABLE_NAME);
Review comment:
Can we have a test where the index table has a different Physical Table
name and data table has a different physical table name?
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
##########
@@ -128,21 +128,15 @@ public RegionScanner getRegionScanner(final Scan scan,
final RegionScanner s) th
PhoenixTransactionContext tx = null;
ColumnReference[] dataColumns =
IndexUtil.deserializeDataTableColumnsToJoin(scan);
if (dataColumns != null) {
- tupleProjector = IndexUtil.getTupleProjector(scan, dataColumns);
- dataRegion = env.getRegion();
- boolean useProto = false;
- byte[] localIndexBytes =
scan.getAttribute(BaseScannerRegionObserver.LOCAL_INDEX_BUILD_PROTO);
- useProto = localIndexBytes != null;
- if (localIndexBytes == null) {
- localIndexBytes =
scan.getAttribute(BaseScannerRegionObserver.LOCAL_INDEX_BUILD);
- }
- int clientVersion = ScanUtil.getClientVersion(scan);
- List<IndexMaintainer> indexMaintainers =
- IndexMaintainer.deserialize(localIndexBytes, useProto);
- indexMaintainer = indexMaintainers.get(0);
- viewConstants = IndexUtil.deserializeViewConstantsFromScan(scan);
- byte[] txState = scan.getAttribute(BaseScannerRegionObserver.TX_STATE);
- tx = TransactionFactory.getTransactionContext(txState, clientVersion);
+ tupleProjector = IndexUtil.getTupleProjector(scan, dataColumns);
+ dataRegion = env.getRegion();
+ int clientVersion = ScanUtil.getClientVersion(scan);
+ List<IndexMaintainer> indexMaintainers =
+ IndexUtil.deSerializeIndexMaintainersFromScan(scan);
+ indexMaintainer = indexMaintainers.get(0);
Review comment:
Why are we getting the first one? I see that we used to do this before
and it is not new but I am confused why how we sort these
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
##########
@@ -345,7 +335,7 @@ private void testOptimizationTenantSpecific(String
dataTableName, String indexTa
" CLIENT PARALLEL 1-WAY RANGE SCAN OVER " +
indexTableName + " \\['tid1','a'\\]\n" +
" SERVER FILTER BY FIRST KEY ONLY\n" +
" DYNAMIC SERVER FILTER BY \\(\"" +
dataTableName + ".K1\", \"" + dataTableName + ".K2\"\\) IN
\\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)";
- assertTrue("Expected:\n" + expected + "\ndid not match\n" +
actual, Pattern.matches(expected, actual));
+ //assertTrue("Expected:\n" + expected + "\ndid not match\n" +
actual, Pattern.matches(expected, actual));
Review comment:
nit: commented code. Forgotten?
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerFactory.java
##########
@@ -215,7 +223,9 @@ public boolean nextRaw(List<Cell> result) throws
IOException {
if (result.size() == 0) {
return next;
}
- if (ScanUtil.isLocalIndex(scan) && !ScanUtil.isAnalyzeTable(scan)) {
+ if ((ScanUtil.isLocalIndex(scan)
+ || ScanUtil.isUncoveredGlobalIndex(scan))
Review comment:
You seem to have this in Line 137 and in GroupedAggregateRegion... as
well. I think it is better to have a ScanUtil.isLocalOrUncoveredGlobalIndex
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
##########
@@ -353,11 +357,12 @@ public final ResultIterator iterator(final
Map<ImmutableBytesPtr,ServerCache> ca
KeyValueSchema schema =
ProjectedColumnExpression.buildSchema(dataColumns);
// Set key value schema of the data columns.
serializeSchemaIntoScan(scan, schema);
-
- // Set index maintainer of the local index.
- serializeIndexMaintainerIntoScan(scan, dataTable);
- // Set view constants if exists.
- serializeViewConstantsIntoScan(scan, dataTable);
+ if (table.getIndexType() == IndexType.LOCAL) {
Review comment:
Don't we need this for global uncovered ones too?
--
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]