From 338584ff6c4c4296710f2ff047ed34f4ddc61e66 Mon Sep 17 00:00:00 2001 From: Mahdi Salarkia Date: Tue, 21 Aug 2018 10:38:49 -0700 Subject: [PATCH] PHOENIX-3547 Supporting more number of indices per table. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the number of indices per Phoenix table is bound to maximum of 65,535 (java.lang.Short) which is a limitation for applications requiring to have unlimited number of indices. This change will consider any new table created in Phoenix to support view index ids to be in the range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (java.lang.Long) which is undoubtedly big enough to cover this requirement. Any existing Phoenix table will still continue to support only maximum of 65535 of indices. A new int column (VIEW_INDEX_ID_DATA_TYPE TINYINT) is added to SYSTEM.CATALOG to specify each Phoenix table's viewIndex data type. On each new Phoenix table creation the value for VIEW_INDEX_ID_DATA_TYPE will be set to Long while this value would be Short for any existing table. According to Protobuf documentation https://developers.google.com/protocol-buffers/docs/proto#updating we can change the type of viewIndexId from int32 to int64 and maintain the backward compatibility for older clients. We did a manual verification for this scenario by creating a view with the old client and verify the new client is able to connect and read/write to the view after changing the viewIndexId type and adding the viewIndexType. --- .../BaseTenantSpecificViewIndexIT.java | 4 +- .../apache/phoenix/end2end/BaseViewIT.java | 8 +- .../end2end/TenantSpecificViewIndexIT.java | 6 +- .../org/apache/phoenix/end2end/UpgradeIT.java | 2 +- .../org/apache/phoenix/end2end/ViewIT.java | 10 +- .../index/ChildViewsUseParentViewIndexIT.java | 4 +- .../index/GlobalIndexOptimizationIT.java | 2 +- .../phoenix/end2end/index/IndexUsageIT.java | 4 +- .../phoenix/end2end/index/LocalIndexIT.java | 2 +- .../end2end/index/MutableIndexFailureIT.java | 4 +- .../phoenix/end2end/index/ViewIndexIT.java | 6 +- .../IndexHalfStoreFileReaderGenerator.java | 3 +- .../phoenix/compile/CreateTableCompiler.java | 3 +- .../phoenix/compile/DeleteCompiler.java | 2 +- .../apache/phoenix/compile/FromCompiler.java | 2 +- .../apache/phoenix/compile/JoinCompiler.java | 2 +- .../compile/TupleProjectionCompiler.java | 4 +- .../apache/phoenix/compile/UnionCompiler.java | 2 +- .../phoenix/compile/UpsertCompiler.java | 2 +- .../phoenix/compile/WhereOptimizer.java | 2 +- .../coprocessor/MetaDataEndpointImpl.java | 55 +- .../phoenix/coprocessor/MetaDataProtocol.java | 53 +- .../coprocessor/generated/MetaDataProtos.java | 471 ++++++++++++------ .../coprocessor/generated/PTableProtos.java | 156 ++++-- .../generated/ServerCachingProtos.java | 128 ++++- .../apache/phoenix/index/IndexMaintainer.java | 15 +- .../index/PhoenixIndexFailurePolicy.java | 2 +- .../apache/phoenix/iterate/ExplainTable.java | 13 +- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 2 + .../query/ConnectionQueryServicesImpl.java | 8 + .../ConnectionlessQueryServicesImpl.java | 2 +- .../apache/phoenix/query/QueryConstants.java | 5 +- .../apache/phoenix/schema/DelegateTable.java | 8 +- .../apache/phoenix/schema/MetaDataClient.java | 21 +- .../org/apache/phoenix/schema/PTable.java | 3 +- .../org/apache/phoenix/schema/PTableImpl.java | 50 +- .../org/apache/phoenix/util/MetaDataUtil.java | 5 + .../TenantSpecificViewIndexCompileTest.java | 6 +- .../phoenix/execute/CorrelatePlanTest.java | 2 +- .../LiteralResultIteratorPlanTest.java | 2 +- .../src/main/MetaDataService.proto | 6 +- phoenix-protocol/src/main/PTable.proto | 3 +- .../src/main/ServerCachingService.proto | 1 + 43 files changed, 780 insertions(+), 311 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java index 9bd689ef0aa..26e28608cb5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificViewIndexIT.java @@ -148,9 +148,9 @@ private void createAndVerifyIndex(Connection conn, String viewName, String table + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); } else { String expected = saltBuckets == null ? - "CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + tableName + " [-32768,'" + tenantId + "','" + valuePrefix + "v2-1']\n" + "CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + tableName + " [-9223372036854775808,'" + tenantId + "','" + valuePrefix + "v2-1']\n" + " SERVER FILTER BY FIRST KEY ONLY" : - "CLIENT PARALLEL 3-WAY RANGE SCAN OVER _IDX_" + tableName + " [0,-32768,'" + tenantId + "','" + valuePrefix + "v2-1'] - ["+(saltBuckets.intValue()-1)+",-32768,'" + tenantId + "','" + valuePrefix + "v2-1']\n" + "CLIENT PARALLEL 3-WAY RANGE SCAN OVER _IDX_" + tableName + " [0,-9223372036854775808,'" + tenantId + "','" + valuePrefix + "v2-1'] - ["+(saltBuckets.intValue()-1)+",-9223372036854775808,'" + tenantId + "','" + valuePrefix + "v2-1']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + "CLIENT MERGE SORT"; diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java index 53abf77ea1c..f081a3ba649 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java @@ -196,8 +196,8 @@ protected Pair testUpdatableViewIndex(Integer saltBuckets, boolean queryPlan); } else { assertEquals(saltBuckets == null - ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName +" [" + Short.MIN_VALUE + ",51]" - : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [0," + Short.MIN_VALUE + ",51] - ["+(saltBuckets.intValue()-1)+"," + Short.MIN_VALUE + ",51]\nCLIENT MERGE SORT", + ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName +" [" + Long.MIN_VALUE + ",51]" + : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [0," + Long.MIN_VALUE + ",51] - ["+(saltBuckets.intValue()-1)+"," + Long.MIN_VALUE + ",51]\nCLIENT MERGE SORT", queryPlan); } @@ -237,9 +237,9 @@ protected Pair testUpdatableViewIndex(Integer saltBuckets, boolean } else { physicalTableName = viewIndexPhysicalName; assertEquals(saltBuckets == null - ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName +" [" + (Short.MIN_VALUE+1) + ",'foo']\n" + ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName +" [" + (Long.MIN_VALUE+1) + ",'foo']\n" + " SERVER FILTER BY FIRST KEY ONLY" - : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [0," + (Short.MIN_VALUE+1) + ",'foo'] - ["+(saltBuckets.intValue()-1)+"," + (Short.MIN_VALUE+1) + ",'foo']\n" + : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [0," + (Long.MIN_VALUE+1) + ",'foo'] - ["+(saltBuckets.intValue()-1)+"," + (Long.MIN_VALUE+1) + ",'foo']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificViewIndexIT.java index 31f356959a5..a3176937220 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificViewIndexIT.java @@ -130,8 +130,8 @@ private void testMultiCFViewIndex(boolean localIndex, boolean isNamespaceEnabled String sequenceNameA = getViewIndexSequenceName(PNameFactory.newName(tableName), PNameFactory.newName(tenantId2), isNamespaceEnabled); String sequenceNameB = getViewIndexSequenceName(PNameFactory.newName(tableName), PNameFactory.newName(tenantId1), isNamespaceEnabled); String sequenceSchemaName = getViewIndexSequenceSchemaName(PNameFactory.newName(tableName), isNamespaceEnabled); - verifySequenceValue(isNamespaceEnabled? tenantId2 : null, sequenceNameA, sequenceSchemaName, -32767); - verifySequenceValue(isNamespaceEnabled? tenantId1 : null, sequenceNameB, sequenceSchemaName, -32767); + verifySequenceValue(isNamespaceEnabled? tenantId2 : null, sequenceNameA, sequenceSchemaName, -9223372036854775807L); + verifySequenceValue(isNamespaceEnabled? tenantId1 : null, sequenceNameB, sequenceSchemaName, -9223372036854775807L); Properties props = new Properties(); props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId2); @@ -207,7 +207,7 @@ private void createViewAndIndexesWithTenantId(String tableName, String viewName, assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + Bytes.toString(MetaDataUtil.getViewIndexPhysicalName( SchemaUtil.getPhysicalTableName(Bytes.toBytes(tableName), isNamespaceMapped).toBytes())) - + " [-32768,'" + tenantId + "','f']\n" + " SERVER FILTER BY FIRST KEY ONLY", + + " [-9223372036854775808,'" + tenantId + "','f']\n" + " SERVER FILTER BY FIRST KEY ONLY", QueryUtil.getExplainPlan(rs)); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java index bb32f6db918..632a2bb3e66 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java @@ -188,7 +188,7 @@ public void testMapTableToNamespaceDuringUpgrade() + " IS NULL AND " + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + " = '" + newSchemaName + "' AND " + PhoenixDatabaseMetaData.SEQUENCE_NAME + "='" + newSequenceName + "'"); assertTrue(rs.next()); - assertEquals("-32765", rs.getString(1)); + assertEquals("-9223372036854775805", rs.getString(1)); rs = phxConn.createStatement().executeQuery("SELECT " + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + "," + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + "," + PhoenixDatabaseMetaData.CURRENT_VALUE + " FROM " + PhoenixDatabaseMetaData.SYSTEM_SEQUENCE + " WHERE " + PhoenixDatabaseMetaData.TENANT_ID diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index ee77e5f8f5e..c759694bfd6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -1263,9 +1263,9 @@ public static Pair testUpdatableViewIndex(String fullTableName, In queryPlan); } else { assertEquals(saltBuckets == null - ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [" + Short.MIN_VALUE + ",51]" + ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [" + Long.MIN_VALUE + ",51]" : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [0," - + Short.MIN_VALUE + ",51] - [" + (saltBuckets.intValue() - 1) + "," + Short.MIN_VALUE + + Long.MIN_VALUE + ",51] - [" + (saltBuckets.intValue() - 1) + "," + Long.MIN_VALUE + ",51]\nCLIENT MERGE SORT", queryPlan); } @@ -1307,10 +1307,10 @@ public static Pair testUpdatableViewIndex(String fullTableName, In assertEquals( saltBuckets == null ? "CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + viewIndexPhysicalName + " [" - + (Short.MIN_VALUE + 1) + ",'foo']\n" + " SERVER FILTER BY FIRST KEY ONLY" + + (Long.MIN_VALUE + 1) + ",'foo']\n" + " SERVER FILTER BY FIRST KEY ONLY" : "CLIENT PARALLEL " + saltBuckets + "-WAY RANGE SCAN OVER " + viewIndexPhysicalName - + " [0," + (Short.MIN_VALUE + 1) + ",'foo'] - [" + (saltBuckets.intValue() - 1) - + "," + (Short.MIN_VALUE + 1) + ",'foo']\n" + + " [0," + (Long.MIN_VALUE + 1) + ",'foo'] - [" + (saltBuckets.intValue() - 1) + + "," + (Long.MIN_VALUE + 1) + ",'foo']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java index f3ee2cb16d7..54528a940af 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java @@ -161,7 +161,7 @@ private void assertQueryUsesIndex(final String baseTableName, final String viewN ResultSet rs = conn.prepareStatement("EXPLAIN " + sql).executeQuery(); String childViewScanKey = isChildView ? ",'Y'" : ""; assertEquals( - "CLIENT PARALLEL 1-WAY SKIP SCAN ON 3 KEYS OVER _IDX_" + baseTableName + " [-32768,'1'" + childViewScanKey + "] - [-32768,'3'" + childViewScanKey + "]\n" + + "CLIENT PARALLEL 1-WAY SKIP SCAN ON 3 KEYS OVER _IDX_" + baseTableName + " [-9223372036854775808,'1'" + childViewScanKey + "] - [-9223372036854775808,'3'" + childViewScanKey + "]\n" + " SERVER FILTER BY FIRST KEY ONLY", QueryUtil.getExplainPlan(rs)); @@ -264,7 +264,7 @@ private void assertQueryIndex(String viewName, String baseTableName, Connection " ORDER BY WO_ID, A_DATE DESC"; ResultSet rs = conn.prepareStatement("EXPLAIN " + sql).executeQuery(); assertEquals( - "CLIENT PARALLEL 1-WAY SKIP SCAN ON 5 RANGES OVER _IDX_" + baseTableName + " [-32768,'00Dxxxxxxxxxxx1','003xxxxxxxxxxx1',*] - [-32768,'00Dxxxxxxxxxxx1','003xxxxxxxxxxx5',~'2016-01-01 06:00:00.000']\n" + + "CLIENT PARALLEL 1-WAY SKIP SCAN ON 5 RANGES OVER _IDX_" + baseTableName + " [-9223372036854775808,'00Dxxxxxxxxxxx1','003xxxxxxxxxxx1',*] - [-9223372036854775808,'00Dxxxxxxxxxxx1','003xxxxxxxxxxx5',~'2016-01-01 06:00:00.000']\n" + " SERVER FILTER BY FIRST KEY ONLY", QueryUtil.getExplainPlan(rs)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java index 51e9de9e5f9..09003b05346 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java @@ -344,7 +344,7 @@ public void testGlobalIndexOptimizationOnSharedIndex() throws Exception { "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + dataTableName + "\n" + " SERVER FILTER BY V1 = 'a'\n" + " SKIP-SCAN-JOIN TABLE 0\n" + - " CLIENT PARALLEL 1-WAY SKIP SCAN ON 2 KEYS OVER _IDX_" + dataTableName + " \\[-32768,1\\] - \\[-32768,2\\]\n" + + " CLIENT PARALLEL 1-WAY SKIP SCAN ON 2 KEYS OVER _IDX_" + dataTableName + " \\[-9223372036854775808,1\\] - \\[-9223372036854775808,2\\]\n" + " SERVER FILTER BY FIRST KEY ONLY AND \"K2\" IN \\(3,4\\)\n" + " DYNAMIC SERVER FILTER BY \\(\"" + viewName + ".T_ID\", \"" + viewName + ".K1\", \"" + viewName + ".K2\"\\) IN \\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)"; assertTrue("Expected:\n" + expected + "\ndid not match\n" + actual, Pattern.matches(expected,actual)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexUsageIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexUsageIT.java index 14b569ad7a0..f114010c660 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexUsageIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexUsageIT.java @@ -496,7 +496,7 @@ private void helpTestUpdatableViewIndex(boolean local) throws Exception { assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + dataTableName + " [1,173]\n" + "CLIENT MERGE SORT", queryPlan); } else { - assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + dataTableName + " [" + Short.MIN_VALUE + ",173]", queryPlan); + assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + dataTableName + " [" + Long.MIN_VALUE + ",173]", queryPlan); } rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); @@ -516,7 +516,7 @@ private void helpTestUpdatableViewIndex(boolean local) throws Exception { + ",'foo2_bar2']\n" + " SERVER FILTER BY FIRST KEY ONLY\n" + "CLIENT MERGE SORT", QueryUtil.getExplainPlan(rs)); } else { - assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + dataTableName + " [" + (Short.MIN_VALUE + 1) + ",'foo2_bar2']\n" + assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_" + dataTableName + " [" + (Long.MIN_VALUE + 1) + ",'foo2_bar2']\n" + " SERVER FILTER BY FIRST KEY ONLY", QueryUtil.getExplainPlan(rs)); } rs = conn.createStatement().executeQuery(query); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index 41616f2822c..5ae964553ab 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -201,7 +201,7 @@ public void testDropLocalIndexTable() throws Exception { Connection conn1 = getConnection(); Connection conn2 = getConnection(); conn1.createStatement().execute("CREATE LOCAL INDEX " + indexName + " ON " + tableName + "(v1)"); - verifySequenceValue(null, sequenceName, sequenceSchemaName,-32767); + verifySequenceValue(null, sequenceName, sequenceSchemaName,-9223372036854775807L); conn2.createStatement().executeQuery("SELECT * FROM " + tableName).next(); conn1.createStatement().execute("DROP TABLE "+ tableName); verifySequenceNotExists(null, sequenceName, sequenceSchemaName); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java index dbda4e8f82c..b5279be3f3f 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java @@ -588,9 +588,9 @@ public void preBatchMutate(ObserverContext c, Mini if (Bytes.toString(family).startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { int regionStartKeyLen = c.getEnvironment().getRegionInfo().getStartKey().length; Cell firstCell = entry.getValue().get(0); - short indexId = MetaDataUtil.getViewIndexIdDataType().getCodec().decodeShort(firstCell.getRowArray(), firstCell.getRowOffset() + regionStartKeyLen, SortOrder.getDefault()); + long indexId = MetaDataUtil.getViewIndexIdDataType().getCodec().decodeLong(firstCell.getRowArray(), firstCell.getRowOffset() + regionStartKeyLen, SortOrder.getDefault()); // Only throw for first local index as the test may have multiple local indexes - if (indexId == Short.MIN_VALUE) { + if (indexId == Long.MIN_VALUE) { throwException = true; break; } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java index 3ce6ae59809..11cfc5c930f 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java @@ -124,10 +124,10 @@ public void testDeleteViewIndexSequences() throws Exception { String sequenceSchemaName = getViewIndexSequenceSchemaName(PNameFactory.newName(fullTableName), isNamespaceMapped); String seqName = getViewIndexSequenceName(PNameFactory.newName(fullTableName), null, !isNamespaceMapped); String seqSchemaName = getViewIndexSequenceSchemaName(PNameFactory.newName(fullTableName), !isNamespaceMapped); - verifySequenceValue(null, sequenceName, sequenceSchemaName, -32767); - verifySequenceValue(null, sequenceName, sequenceSchemaName, -32767); + verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775807L); + verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775807L); conn1.createStatement().execute("CREATE INDEX " + indexName + "_2 ON " + fullViewName + " (v1)"); - verifySequenceValue(null, sequenceName, sequenceSchemaName, -32766); + verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775806L); // Check other format of sequence is not there as Sequences format is different for views/indexes created on // table which are namespace mapped and which are not. verifySequenceNotExists(null, seqName, seqSchemaName); diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java index a72aa921ba3..6b863f7c881 100644 --- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java +++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java @@ -164,8 +164,7 @@ public StoreFileReader preStoreFileReaderOpen(ObserverContext emptyList(), false, Collections. emptyList(), null, null, false, false, - false, null, null, null, false, null, 0, 0L, SchemaUtil + false, null, null, null, null, false, null, 0, 0L, SchemaUtil .isNamespaceMappingEnabled(PTableType.SUBQUERY, connection.getQueryServices().getProps()), null, false, ImmutableStorageScheme.ONE_CELL_PER_COLUMN, QualifierEncodingScheme.NON_ENCODED_QUALIFIERS, PTable.EncodedCQCounter.NULL_COUNTER, true); String alias = subselectNode.getAlias(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java index 824d933d683..36bfc5fdc23 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java @@ -1275,7 +1275,7 @@ public static PTable joinProjectedTables(PTable left, PTable right, JoinType typ left.getType(), left.getIndexState(), left.getTimeStamp(), left.getSequenceNumber(), left.getPKName(), left.getBucketNum(), merged, left.getParentSchemaName(), left.getParentTableName(), left.getIndexes(), left.isImmutableRows(), Collections. emptyList(), null, null, PTable.DEFAULT_DISABLE_WAL, - left.isMultiTenant(), left.getStoreNulls(), left.getViewType(), left.getViewIndexId(), + left.isMultiTenant(), left.getStoreNulls(), left.getViewType(), left.getViewIndexType(), left.getViewIndexId(), left.getIndexType(), left.rowKeyOrderOptimizable(), left.getTransactionProvider(), left.getUpdateCacheFrequency(), left.getIndexDisableTimestamp(), left.isNamespaceMapped(), left.getAutoPartitionSeqName(), left.isAppendOnlySchema(), ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, PTable.EncodedCQCounter.NULL_COUNTER, left.useStatsForParallelization()); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index 91be356c7e9..a2937bfb6a3 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -166,7 +166,7 @@ public static PTable createProjectedTable(SelectStatement select, StatementConte table.getPKName(), table.getBucketNum(), projectedColumns, table.getParentSchemaName(), table.getParentTableName(), table.getIndexes(), table.isImmutableRows(), Collections. emptyList(), table.getDefaultFamilyName(), table.getViewStatement(), table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), - table.getViewIndexId(), + table.getViewIndexType(), table.getViewIndexId(), table.getIndexType(), table.rowKeyOrderOptimizable(), table.getTransactionProvider(), table.getUpdateCacheFrequency(), table.getIndexDisableTimestamp(), table.isNamespaceMapped(), table.getAutoPartitionSeqName(), table.isAppendOnlySchema(), table.getImmutableStorageScheme(), table.getEncodingScheme(), table.getEncodedCQCounter(), table.useStatsForParallelization()); } @@ -198,7 +198,7 @@ public static PTable createProjectedTable(TableRef tableRef, List sou table.getBucketNum(), projectedColumns, null, null, Collections. emptyList(), table.isImmutableRows(), Collections. emptyList(), null, null, table.isWALDisabled(), table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), - table.getViewIndexId(), null, table.rowKeyOrderOptimizable(), table.getTransactionProvider(), + table.getViewIndexType(), table.getViewIndexId(), null, table.rowKeyOrderOptimizable(), table.getTransactionProvider(), table.getUpdateCacheFrequency(), table.getIndexDisableTimestamp(), table.isNamespaceMapped(), table.getAutoPartitionSeqName(), table.isAppendOnlySchema(), table.getImmutableStorageScheme(), table.getEncodingScheme(), cqCounter, table.useStatsForParallelization()); } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UnionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UnionCompiler.java index c94634bb822..c0c63ebdefd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UnionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UnionCompiler.java @@ -100,7 +100,7 @@ public static TableRef contructSchemaTable(PhoenixStatement statement, List Short.MAX_VALUE) { - builder.setReturnCode(MetaDataProtos.MutationCode.TOO_MANY_INDEXES); - builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis()); - done.run(builder.build()); - return; - } Put tableHeaderPut = MetaDataUtil.getPutOnlyTableHeaderRow(tableMetadata); NavigableMap> familyCellMap = tableHeaderPut.getFamilyCellMap(); @@ -2208,7 +2234,7 @@ public void createTable(RpcController controller, CreateTableRequest request, VIEW_INDEX_ID_BYTES.length, cell.getTimestamp(), bytes, 0, bytes.length, cell.getType()); cells.add(indexIdCell); - indexId = (short) seqValue; + indexId = seqValue; } } @@ -2284,7 +2310,8 @@ public void createTable(RpcController controller, CreateTableRequest request, long currentTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetadata); builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_NOT_FOUND); if (indexId != null) { - builder.setViewIndexId(indexId); + builder.setViewIndexId(indexId); + builder.setViewIndexType(PLong.INSTANCE.getSqlType()); } builder.setMutationTime(currentTimeStamp); done.run(builder.build()); @@ -4533,4 +4560,4 @@ private TableName getParentPhysicalTableName(PTable table) { table.getTableName(), table.isNamespaceMapped()) .getBytes()); } -} \ No newline at end of file +} diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index 874a382bea5..1311230bac8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -38,11 +38,13 @@ import org.apache.phoenix.schema.PNameFactory; import org.apache.phoenix.schema.PTable; import org.apache.phoenix.schema.PTableImpl; +import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.util.ByteUtil; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.protobuf.ByteString; +import org.apache.phoenix.util.MetaDataUtil; /** * @@ -175,7 +177,8 @@ public static class SharedTableState { private PName tableName; private List columns; private List physicalNames; - private Short viewIndexId; + private PDataType viewIndexType; + private Long viewIndexId; public SharedTableState(PTable table) { this.tenantId = table.getTenantId(); @@ -183,6 +186,7 @@ public SharedTableState(PTable table) { this.tableName = table.getTableName(); this.columns = table.getColumns(); this.physicalNames = table.getPhysicalNames(); + this.viewIndexType = table.getViewIndexType(); this.viewIndexId = table.getViewIndexId(); } @@ -205,7 +209,10 @@ public PName apply(ByteString physicalName) { return PNameFactory.newName(physicalName.toByteArray()); } }); - this.viewIndexId = (short)sharedTable.getViewIndexId(); + this.viewIndexId = sharedTable.getViewIndexId(); + this.viewIndexType = sharedTable.hasViewIndexType() + ? PDataType.fromTypeId(sharedTable.getViewIndexType()) + : MetaDataUtil.getLegacyViewIndexIdDataType(); } public PName getTenantId() { @@ -228,10 +235,13 @@ public List getPhysicalNames() { return physicalNames; } - public Short getViewIndexId() { + public Long getViewIndexId() { return viewIndexId; } - + + public PDataType getViewIndexType() { + return viewIndexType; + } } public static class MetaDataMutationResult { @@ -244,8 +254,8 @@ public static class MetaDataMutationResult { private byte[] familyName; private boolean wasUpdated; private PSchema schema; - private Short viewIndexId; - + private Long viewIndexId; + private PDataType viewIndexType; private List functions = new ArrayList(1); private long autoPartitionNum; @@ -290,9 +300,10 @@ public MetaDataMutationResult(MutationCode returnCode, long currentTime, PTable this.tableNamesToDelete = tableNamesToDelete; } - public MetaDataMutationResult(MutationCode returnCode, int currentTime, PTable table, int viewIndexId) { + public MetaDataMutationResult(MutationCode returnCode, int currentTime, PTable table, long viewIndexId, PDataType viewIndexType ) { this(returnCode, currentTime, table, Collections. emptyList()); - this.viewIndexId = (short)viewIndexId; + this.viewIndexId = viewIndexId; + this.viewIndexType = viewIndexType; } public MetaDataMutationResult(MutationCode returnCode, long currentTime, PTable table, List tableNamesToDelete, List sharedTablesToDelete) { @@ -348,10 +359,14 @@ public long getAutoPartitionNum() { return autoPartitionNum; } - public Short getViewIndexId() { + public Long getViewIndexId() { return viewIndexId; } + public PDataType getViewIndexType() { + return viewIndexType; + } + public static MetaDataMutationResult constructFromProto(MetaDataResponse proto) { MetaDataMutationResult result = new MetaDataMutationResult(); result.returnCode = MutationCode.values()[proto.getReturnCode().ordinal()]; @@ -393,9 +408,13 @@ public static MetaDataMutationResult constructFromProto(MetaDataResponse proto) if (proto.hasAutoPartitionNum()) { result.autoPartitionNum = proto.getAutoPartitionNum(); } - if (proto.hasViewIndexId()) { - result.viewIndexId = (short)proto.getViewIndexId(); - } + if (proto.hasViewIndexId()) { + result.viewIndexId = proto.getViewIndexId(); + } + + result.viewIndexType = proto.hasViewIndexType() + ? PDataType.fromTypeId(proto.getViewIndexType()) + : MetaDataUtil.getLegacyViewIndexIdDataType(); return result; } @@ -436,6 +455,7 @@ public static MetaDataResponse toProto(MetaDataMutationResult result) { sharedTableStateBuilder.setSchemaName(ByteStringer.wrap(sharedTableState.getSchemaName().getBytes())); sharedTableStateBuilder.setTableName(ByteStringer.wrap(sharedTableState.getTableName().getBytes())); sharedTableStateBuilder.setViewIndexId(sharedTableState.getViewIndexId()); + sharedTableStateBuilder.setViewIndexType(sharedTableState.viewIndexType.getSqlType()); builder.addSharedTablesToDelete(sharedTableStateBuilder.build()); } } @@ -443,9 +463,12 @@ public static MetaDataResponse toProto(MetaDataMutationResult result) { builder.setSchema(PSchema.toProto(result.schema)); } builder.setAutoPartitionNum(result.getAutoPartitionNum()); - if (result.getViewIndexId() != null) { - builder.setViewIndexId(result.getViewIndexId()); - } + if (result.getViewIndexId() != null) { + builder.setViewIndexId(result.getViewIndexId()); + builder.setViewIndexType(result.getViewIndexType() == null + ? MetaDataUtil.getLegacyViewIndexIdDataType().getSqlType() + : result.getViewIndexType().getSqlType()); + } } return builder.build(); } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java index 744dc7ec16d..360dd771874 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/MetaDataProtos.java @@ -369,15 +369,25 @@ org.apache.phoenix.coprocessor.generated.PTableProtos.PColumnOrBuilder getColumn */ com.google.protobuf.ByteString getPhysicalNames(int index); - // required int32 viewIndexId = 6; + // required int64 viewIndexId = 6; /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ boolean hasViewIndexId(); /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ - int getViewIndexId(); + long getViewIndexId(); + + // optional int32 viewIndexType = 7 [default = 5]; + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + boolean hasViewIndexType(); + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + int getViewIndexType(); } /** * Protobuf type {@code SharedTableState} @@ -463,7 +473,12 @@ private SharedTableState( } case 48: { bitField0_ |= 0x00000008; - viewIndexId_ = input.readInt32(); + viewIndexId_ = input.readInt64(); + break; + } + case 56: { + bitField0_ |= 0x00000010; + viewIndexType_ = input.readInt32(); break; } } @@ -619,29 +634,46 @@ public com.google.protobuf.ByteString getPhysicalNames(int index) { return physicalNames_.get(index); } - // required int32 viewIndexId = 6; + // required int64 viewIndexId = 6; public static final int VIEWINDEXID_FIELD_NUMBER = 6; - private int viewIndexId_; + private long viewIndexId_; /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } + // optional int32 viewIndexType = 7 [default = 5]; + public static final int VIEWINDEXTYPE_FIELD_NUMBER = 7; + private int viewIndexType_; + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + private void initFields() { tenantId_ = com.google.protobuf.ByteString.EMPTY; schemaName_ = com.google.protobuf.ByteString.EMPTY; tableName_ = com.google.protobuf.ByteString.EMPTY; columns_ = java.util.Collections.emptyList(); physicalNames_ = java.util.Collections.emptyList(); - viewIndexId_ = 0; + viewIndexId_ = 0L; + viewIndexType_ = 5; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -689,7 +721,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) output.writeBytes(5, physicalNames_.get(i)); } if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(6, viewIndexId_); + output.writeInt64(6, viewIndexId_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(7, viewIndexType_); } getUnknownFields().writeTo(output); } @@ -727,7 +762,11 @@ public int getSerializedSize() { } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, viewIndexId_); + .computeInt64Size(6, viewIndexId_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, viewIndexType_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -776,6 +815,11 @@ public boolean equals(final java.lang.Object obj) { result = result && (getViewIndexId() == other.getViewIndexId()); } + result = result && (hasViewIndexType() == other.hasViewIndexType()); + if (hasViewIndexType()) { + result = result && (getViewIndexType() + == other.getViewIndexType()); + } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; @@ -811,7 +855,11 @@ public int hashCode() { } if (hasViewIndexId()) { hash = (37 * hash) + VIEWINDEXID_FIELD_NUMBER; - hash = (53 * hash) + getViewIndexId(); + hash = (53 * hash) + hashLong(getViewIndexId()); + } + if (hasViewIndexType()) { + hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexType(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -937,8 +985,10 @@ public Builder clear() { } physicalNames_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); - viewIndexId_ = 0; + viewIndexId_ = 0L; bitField0_ = (bitField0_ & ~0x00000020); + viewIndexType_ = 5; + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -997,6 +1047,10 @@ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.SharedTableState to_bitField0_ |= 0x00000008; } result.viewIndexId_ = viewIndexId_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000010; + } + result.viewIndexType_ = viewIndexType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -1061,6 +1115,9 @@ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.MetaDataProtos if (other.hasViewIndexId()) { setViewIndexId(other.getViewIndexId()); } + if (other.hasViewIndexType()) { + setViewIndexType(other.getViewIndexType()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -1526,35 +1583,68 @@ public Builder clearPhysicalNames() { return this; } - // required int32 viewIndexId = 6; - private int viewIndexId_ ; + // required int64 viewIndexId = 6; + private long viewIndexId_ ; /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ - public Builder setViewIndexId(int value) { + public Builder setViewIndexId(long value) { bitField0_ |= 0x00000020; viewIndexId_ = value; onChanged(); return this; } /** - * required int32 viewIndexId = 6; + * required int64 viewIndexId = 6; */ public Builder clearViewIndexId() { bitField0_ = (bitField0_ & ~0x00000020); - viewIndexId_ = 0; + viewIndexId_ = 0L; + onChanged(); + return this; + } + + // optional int32 viewIndexType = 7 [default = 5]; + private int viewIndexType_ = 5; + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public Builder setViewIndexType(int value) { + bitField0_ |= 0x00000040; + viewIndexType_ = value; + onChanged(); + return this; + } + /** + * optional int32 viewIndexType = 7 [default = 5]; + */ + public Builder clearViewIndexType() { + bitField0_ = (bitField0_ & ~0x00000040); + viewIndexType_ = 5; onChanged(); return this; } @@ -1725,15 +1815,25 @@ org.apache.phoenix.coprocessor.generated.MetaDataProtos.SharedTableStateOrBuilde */ long getAutoPartitionNum(); - // optional int32 viewIndexId = 12; + // optional int64 viewIndexId = 12; /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ boolean hasViewIndexId(); /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ - int getViewIndexId(); + long getViewIndexId(); + + // optional int32 viewIndexType = 13 [default = 5]; + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + boolean hasViewIndexType(); + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + int getViewIndexType(); } /** * Protobuf type {@code MetaDataResponse} @@ -1874,7 +1974,12 @@ private MetaDataResponse( } case 96: { bitField0_ |= 0x00000100; - viewIndexId_ = input.readInt32(); + viewIndexId_ = input.readInt64(); + break; + } + case 104: { + bitField0_ |= 0x00000200; + viewIndexType_ = input.readInt32(); break; } } @@ -2161,22 +2266,38 @@ public long getAutoPartitionNum() { return autoPartitionNum_; } - // optional int32 viewIndexId = 12; + // optional int64 viewIndexId = 12; public static final int VIEWINDEXID_FIELD_NUMBER = 12; - private int viewIndexId_; + private long viewIndexId_; /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } + // optional int32 viewIndexType = 13 [default = 5]; + public static final int VIEWINDEXTYPE_FIELD_NUMBER = 13; + private int viewIndexType_; + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + private void initFields() { returnCode_ = org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS; mutationTime_ = 0L; @@ -2189,7 +2310,8 @@ private void initFields() { sharedTablesToDelete_ = java.util.Collections.emptyList(); schema_ = org.apache.phoenix.coprocessor.generated.PSchemaProtos.PSchema.getDefaultInstance(); autoPartitionNum_ = 0L; - viewIndexId_ = 0; + viewIndexId_ = 0L; + viewIndexType_ = 5; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -2261,7 +2383,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) output.writeInt64(11, autoPartitionNum_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { - output.writeInt32(12, viewIndexId_); + output.writeInt64(12, viewIndexId_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + output.writeInt32(13, viewIndexType_); } getUnknownFields().writeTo(output); } @@ -2323,7 +2448,11 @@ public int getSerializedSize() { } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(12, viewIndexId_); + .computeInt64Size(12, viewIndexId_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, viewIndexType_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -2399,6 +2528,11 @@ public boolean equals(final java.lang.Object obj) { result = result && (getViewIndexId() == other.getViewIndexId()); } + result = result && (hasViewIndexType() == other.hasViewIndexType()); + if (hasViewIndexType()) { + result = result && (getViewIndexType() + == other.getViewIndexType()); + } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; @@ -2458,7 +2592,11 @@ public int hashCode() { } if (hasViewIndexId()) { hash = (37 * hash) + VIEWINDEXID_FIELD_NUMBER; - hash = (53 * hash) + getViewIndexId(); + hash = (53 * hash) + hashLong(getViewIndexId()); + } + if (hasViewIndexType()) { + hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexType(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -2611,8 +2749,10 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00000200); autoPartitionNum_ = 0L; bitField0_ = (bitField0_ & ~0x00000400); - viewIndexId_ = 0; + viewIndexId_ = 0L; bitField0_ = (bitField0_ & ~0x00000800); + viewIndexType_ = 5; + bitField0_ = (bitField0_ & ~0x00001000); return this; } @@ -2708,6 +2848,10 @@ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse to_bitField0_ |= 0x00000100; } result.viewIndexId_ = viewIndexId_; + if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + to_bitField0_ |= 0x00000200; + } + result.viewIndexType_ = viewIndexType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -2813,6 +2957,9 @@ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.MetaDataProtos if (other.hasViewIndexId()) { setViewIndexId(other.getViewIndexId()); } + if (other.hasViewIndexType()) { + setViewIndexType(other.getViewIndexType()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -3860,35 +4007,68 @@ public Builder clearAutoPartitionNum() { return this; } - // optional int32 viewIndexId = 12; - private int viewIndexId_ ; + // optional int64 viewIndexId = 12; + private long viewIndexId_ ; /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ - public Builder setViewIndexId(int value) { + public Builder setViewIndexId(long value) { bitField0_ |= 0x00000800; viewIndexId_ = value; onChanged(); return this; } /** - * optional int32 viewIndexId = 12; + * optional int64 viewIndexId = 12; */ public Builder clearViewIndexId() { bitField0_ = (bitField0_ & ~0x00000800); - viewIndexId_ = 0; + viewIndexId_ = 0L; + onChanged(); + return this; + } + + // optional int32 viewIndexType = 13 [default = 5]; + private int viewIndexType_ = 5; + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public Builder setViewIndexType(int value) { + bitField0_ |= 0x00001000; + viewIndexType_ = value; + onChanged(); + return this; + } + /** + * optional int32 viewIndexType = 13 [default = 5]; + */ + public Builder clearViewIndexType() { + bitField0_ = (bitField0_ & ~0x00001000); + viewIndexType_ = 5; onChanged(); return this; } @@ -17647,104 +17827,105 @@ public org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearTableFromCac static { java.lang.String[] descriptorData = { "\n\025MetaDataService.proto\032\014PTable.proto\032\017P" + - "Function.proto\032\rPSchema.proto\"\222\001\n\020Shared" + + "Function.proto\032\rPSchema.proto\"\254\001\n\020Shared" + "TableState\022\020\n\010tenantId\030\001 \001(\014\022\022\n\nschemaNa" + "me\030\002 \002(\014\022\021\n\ttableName\030\003 \002(\014\022\031\n\007columns\030\004" + " \003(\0132\010.PColumn\022\025\n\rphysicalNames\030\005 \003(\014\022\023\n" + - "\013viewIndexId\030\006 \002(\005\"\321\002\n\020MetaDataResponse\022" + - "!\n\nreturnCode\030\001 \001(\0162\r.MutationCode\022\024\n\014mu" + - "tationTime\030\002 \001(\003\022\026\n\005table\030\003 \001(\0132\007.PTable" + - "\022\026\n\016tablesToDelete\030\004 \003(\014\022\022\n\ncolumnName\030\005" + - " \001(\014\022\022\n\nfamilyName\030\006 \001(\014\022\024\n\014functionName", - "\030\007 \001(\014\022\034\n\010function\030\010 \003(\0132\n.PFunction\022/\n\024" + - "sharedTablesToDelete\030\t \003(\0132\021.SharedTable" + - "State\022\030\n\006schema\030\n \001(\0132\010.PSchema\022\030\n\020autoP" + - "artitionNum\030\013 \001(\003\022\023\n\013viewIndexId\030\014 \001(\005\"\364" + - "\001\n\017GetTableRequest\022\020\n\010tenantId\030\001 \002(\014\022\022\n\n" + - "schemaName\030\002 \002(\014\022\021\n\ttableName\030\003 \002(\014\022\026\n\016t" + - "ableTimestamp\030\004 \002(\003\022\027\n\017clientTimestamp\030\005" + - " \002(\003\022\025\n\rclientVersion\030\006 \001(\005\022\037\n\027skipAddin" + - "gParentColumns\030\007 \001(\010\022\031\n\021skipAddingIndexe" + - "s\030\010 \001(\010\022$\n\023lockedAncestorTable\030\t \001(\0132\007.P", - "Table\"\212\001\n\023GetFunctionsRequest\022\020\n\010tenantI" + - "d\030\001 \002(\014\022\025\n\rfunctionNames\030\002 \003(\014\022\032\n\022functi" + - "onTimestamps\030\003 \003(\003\022\027\n\017clientTimestamp\030\004 " + - "\002(\003\022\025\n\rclientVersion\030\005 \001(\005\"V\n\020GetSchemaR" + - "equest\022\022\n\nschemaName\030\001 \002(\t\022\027\n\017clientTime" + - "stamp\030\002 \002(\003\022\025\n\rclientVersion\030\003 \002(\005\"d\n\022Cr" + - "eateTableRequest\022\036\n\026tableMetadataMutatio" + - "ns\030\001 \003(\014\022\025\n\rclientVersion\030\002 \001(\005\022\027\n\017alloc" + - "ateIndexId\030\003 \001(\010\"r\n\025CreateFunctionReques" + - "t\022\036\n\026tableMetadataMutations\030\001 \003(\014\022\021\n\ttem", - "porary\030\002 \002(\010\022\017\n\007replace\030\003 \001(\010\022\025\n\rclientV" + - "ersion\030\004 \001(\005\"`\n\023CreateSchemaRequest\022\036\n\026t" + - "ableMetadataMutations\030\001 \003(\014\022\022\n\nschemaNam" + - "e\030\002 \002(\t\022\025\n\rclientVersion\030\003 \002(\005\"\216\001\n\020DropT" + - "ableRequest\022\036\n\026tableMetadataMutations\030\001 " + - "\003(\014\022\021\n\ttableType\030\002 \002(\t\022\017\n\007cascade\030\003 \001(\010\022" + - "\025\n\rclientVersion\030\004 \001(\005\022\037\n\027skipAddingPare" + - "ntColumns\030\005 \001(\010\"_\n\021DropSchemaRequest\022\037\n\027" + - "schemaMetadataMutations\030\001 \003(\014\022\022\n\nschemaN" + - "ame\030\002 \002(\t\022\025\n\rclientVersion\030\003 \002(\005\"I\n\020AddC", - "olumnRequest\022\036\n\026tableMetadataMutations\030\001" + - " \003(\014\022\025\n\rclientVersion\030\002 \001(\005\"J\n\021DropColum" + - "nRequest\022\036\n\026tableMetadataMutations\030\001 \003(\014" + - "\022\025\n\rclientVersion\030\002 \001(\005\"^\n\023DropFunctionR" + - "equest\022\036\n\026tableMetadataMutations\030\001 \003(\014\022\020" + - "\n\010ifExists\030\002 \001(\010\022\025\n\rclientVersion\030\003 \001(\005\"" + - "P\n\027UpdateIndexStateRequest\022\036\n\026tableMetad" + - "ataMutations\030\001 \003(\014\022\025\n\rclientVersion\030\002 \001(" + - "\005\"*\n\021ClearCacheRequest\022\025\n\rclientVersion\030" + - "\001 \001(\005\"*\n\022ClearCacheResponse\022\024\n\014unfreedBy", - "tes\030\001 \001(\003\"*\n\021GetVersionRequest\022\025\n\rclient" + - "Version\030\001 \001(\005\"E\n\022GetVersionResponse\022\017\n\007v" + - "ersion\030\001 \002(\003\022\036\n\026systemCatalogTimestamp\030\002" + - " \001(\003\"\205\001\n\032ClearTableFromCacheRequest\022\020\n\010t" + - "enantId\030\001 \002(\014\022\022\n\nschemaName\030\002 \002(\014\022\021\n\ttab" + - "leName\030\003 \002(\014\022\027\n\017clientTimestamp\030\004 \002(\003\022\025\n" + - "\rclientVersion\030\005 \001(\005\"\035\n\033ClearTableFromCa" + - "cheResponse*\271\005\n\014MutationCode\022\030\n\024TABLE_AL" + - "READY_EXISTS\020\000\022\023\n\017TABLE_NOT_FOUND\020\001\022\024\n\020C" + - "OLUMN_NOT_FOUND\020\002\022\031\n\025COLUMN_ALREADY_EXIS", - "TS\020\003\022\035\n\031CONCURRENT_TABLE_MUTATION\020\004\022\027\n\023T" + - "ABLE_NOT_IN_REGION\020\005\022\025\n\021NEWER_TABLE_FOUN" + - "D\020\006\022\034\n\030UNALLOWED_TABLE_MUTATION\020\007\022\021\n\rNO_" + - "PK_COLUMNS\020\010\022\032\n\026PARENT_TABLE_NOT_FOUND\020\t" + - "\022\033\n\027FUNCTION_ALREADY_EXISTS\020\n\022\026\n\022FUNCTIO" + - "N_NOT_FOUND\020\013\022\030\n\024NEWER_FUNCTION_FOUND\020\014\022" + - "\032\n\026FUNCTION_NOT_IN_REGION\020\r\022\031\n\025SCHEMA_AL" + - "READY_EXISTS\020\016\022\026\n\022NEWER_SCHEMA_FOUND\020\017\022\024" + - "\n\020SCHEMA_NOT_FOUND\020\020\022\030\n\024SCHEMA_NOT_IN_RE" + - "GION\020\021\022\032\n\026TABLES_EXIST_ON_SCHEMA\020\022\022\035\n\031UN", - "ALLOWED_SCHEMA_MUTATION\020\023\022%\n!AUTO_PARTIT" + - "ION_SEQUENCE_NOT_FOUND\020\024\022#\n\037CANNOT_COERC" + - "E_AUTO_PARTITION_ID\020\025\022\024\n\020TOO_MANY_INDEXE" + - "S\020\026\022\037\n\033UNABLE_TO_CREATE_CHILD_LINK\020\027\022!\n\035" + - "UNABLE_TO_UPDATE_PARENT_TABLE\020\0302\345\006\n\017Meta" + - "DataService\022/\n\010getTable\022\020.GetTableReques" + - "t\032\021.MetaDataResponse\0227\n\014getFunctions\022\024.G" + - "etFunctionsRequest\032\021.MetaDataResponse\0221\n" + - "\tgetSchema\022\021.GetSchemaRequest\032\021.MetaData" + - "Response\0225\n\013createTable\022\023.CreateTableReq", - "uest\032\021.MetaDataResponse\022;\n\016createFunctio" + - "n\022\026.CreateFunctionRequest\032\021.MetaDataResp" + - "onse\0227\n\014createSchema\022\024.CreateSchemaReque" + - "st\032\021.MetaDataResponse\0221\n\tdropTable\022\021.Dro" + - "pTableRequest\032\021.MetaDataResponse\0223\n\ndrop" + - "Schema\022\022.DropSchemaRequest\032\021.MetaDataRes" + - "ponse\0227\n\014dropFunction\022\024.DropFunctionRequ" + - "est\032\021.MetaDataResponse\0221\n\taddColumn\022\021.Ad" + - "dColumnRequest\032\021.MetaDataResponse\0223\n\ndro" + - "pColumn\022\022.DropColumnRequest\032\021.MetaDataRe", - "sponse\022?\n\020updateIndexState\022\030.UpdateIndex" + - "StateRequest\032\021.MetaDataResponse\0225\n\nclear" + - "Cache\022\022.ClearCacheRequest\032\023.ClearCacheRe" + - "sponse\0225\n\ngetVersion\022\022.GetVersionRequest" + - "\032\023.GetVersionResponse\022P\n\023clearTableFromC" + - "ache\022\033.ClearTableFromCacheRequest\032\034.Clea" + - "rTableFromCacheResponseBB\n(org.apache.ph" + - "oenix.coprocessor.generatedB\016MetaDataPro" + - "tosH\001\210\001\001\240\001\001" + "\013viewIndexId\030\006 \002(\003\022\030\n\rviewIndexType\030\007 \001(" + + "\005:\0015\"\353\002\n\020MetaDataResponse\022!\n\nreturnCode\030" + + "\001 \001(\0162\r.MutationCode\022\024\n\014mutationTime\030\002 \001" + + "(\003\022\026\n\005table\030\003 \001(\0132\007.PTable\022\026\n\016tablesToDe" + + "lete\030\004 \003(\014\022\022\n\ncolumnName\030\005 \001(\014\022\022\n\nfamily", + "Name\030\006 \001(\014\022\024\n\014functionName\030\007 \001(\014\022\034\n\010func" + + "tion\030\010 \003(\0132\n.PFunction\022/\n\024sharedTablesTo" + + "Delete\030\t \003(\0132\021.SharedTableState\022\030\n\006schem" + + "a\030\n \001(\0132\010.PSchema\022\030\n\020autoPartitionNum\030\013 " + + "\001(\003\022\023\n\013viewIndexId\030\014 \001(\003\022\030\n\rviewIndexTyp" + + "e\030\r \001(\005:\0015\"\364\001\n\017GetTableRequest\022\020\n\010tenant" + + "Id\030\001 \002(\014\022\022\n\nschemaName\030\002 \002(\014\022\021\n\ttableNam" + + "e\030\003 \002(\014\022\026\n\016tableTimestamp\030\004 \002(\003\022\027\n\017clien" + + "tTimestamp\030\005 \002(\003\022\025\n\rclientVersion\030\006 \001(\005\022" + + "\037\n\027skipAddingParentColumns\030\007 \001(\010\022\031\n\021skip", + "AddingIndexes\030\010 \001(\010\022$\n\023lockedAncestorTab" + + "le\030\t \001(\0132\007.PTable\"\212\001\n\023GetFunctionsReques" + + "t\022\020\n\010tenantId\030\001 \002(\014\022\025\n\rfunctionNames\030\002 \003" + + "(\014\022\032\n\022functionTimestamps\030\003 \003(\003\022\027\n\017client" + + "Timestamp\030\004 \002(\003\022\025\n\rclientVersion\030\005 \001(\005\"V" + + "\n\020GetSchemaRequest\022\022\n\nschemaName\030\001 \002(\t\022\027" + + "\n\017clientTimestamp\030\002 \002(\003\022\025\n\rclientVersion" + + "\030\003 \002(\005\"d\n\022CreateTableRequest\022\036\n\026tableMet" + + "adataMutations\030\001 \003(\014\022\025\n\rclientVersion\030\002 " + + "\001(\005\022\027\n\017allocateIndexId\030\003 \001(\010\"r\n\025CreateFu", + "nctionRequest\022\036\n\026tableMetadataMutations\030" + + "\001 \003(\014\022\021\n\ttemporary\030\002 \002(\010\022\017\n\007replace\030\003 \001(" + + "\010\022\025\n\rclientVersion\030\004 \001(\005\"`\n\023CreateSchema" + + "Request\022\036\n\026tableMetadataMutations\030\001 \003(\014\022" + + "\022\n\nschemaName\030\002 \002(\t\022\025\n\rclientVersion\030\003 \002" + + "(\005\"\216\001\n\020DropTableRequest\022\036\n\026tableMetadata" + + "Mutations\030\001 \003(\014\022\021\n\ttableType\030\002 \002(\t\022\017\n\007ca" + + "scade\030\003 \001(\010\022\025\n\rclientVersion\030\004 \001(\005\022\037\n\027sk" + + "ipAddingParentColumns\030\005 \001(\010\"_\n\021DropSchem" + + "aRequest\022\037\n\027schemaMetadataMutations\030\001 \003(", + "\014\022\022\n\nschemaName\030\002 \002(\t\022\025\n\rclientVersion\030\003" + + " \002(\005\"I\n\020AddColumnRequest\022\036\n\026tableMetadat" + + "aMutations\030\001 \003(\014\022\025\n\rclientVersion\030\002 \001(\005\"" + + "J\n\021DropColumnRequest\022\036\n\026tableMetadataMut" + + "ations\030\001 \003(\014\022\025\n\rclientVersion\030\002 \001(\005\"^\n\023D" + + "ropFunctionRequest\022\036\n\026tableMetadataMutat" + + "ions\030\001 \003(\014\022\020\n\010ifExists\030\002 \001(\010\022\025\n\rclientVe" + + "rsion\030\003 \001(\005\"P\n\027UpdateIndexStateRequest\022\036" + + "\n\026tableMetadataMutations\030\001 \003(\014\022\025\n\rclient" + + "Version\030\002 \001(\005\"*\n\021ClearCacheRequest\022\025\n\rcl", + "ientVersion\030\001 \001(\005\"*\n\022ClearCacheResponse\022" + + "\024\n\014unfreedBytes\030\001 \001(\003\"*\n\021GetVersionReque" + + "st\022\025\n\rclientVersion\030\001 \001(\005\"E\n\022GetVersionR" + + "esponse\022\017\n\007version\030\001 \002(\003\022\036\n\026systemCatalo" + + "gTimestamp\030\002 \001(\003\"\205\001\n\032ClearTableFromCache" + + "Request\022\020\n\010tenantId\030\001 \002(\014\022\022\n\nschemaName\030" + + "\002 \002(\014\022\021\n\ttableName\030\003 \002(\014\022\027\n\017clientTimest" + + "amp\030\004 \002(\003\022\025\n\rclientVersion\030\005 \001(\005\"\035\n\033Clea" + + "rTableFromCacheResponse*\271\005\n\014MutationCode" + + "\022\030\n\024TABLE_ALREADY_EXISTS\020\000\022\023\n\017TABLE_NOT_", + "FOUND\020\001\022\024\n\020COLUMN_NOT_FOUND\020\002\022\031\n\025COLUMN_" + + "ALREADY_EXISTS\020\003\022\035\n\031CONCURRENT_TABLE_MUT" + + "ATION\020\004\022\027\n\023TABLE_NOT_IN_REGION\020\005\022\025\n\021NEWE" + + "R_TABLE_FOUND\020\006\022\034\n\030UNALLOWED_TABLE_MUTAT" + + "ION\020\007\022\021\n\rNO_PK_COLUMNS\020\010\022\032\n\026PARENT_TABLE" + + "_NOT_FOUND\020\t\022\033\n\027FUNCTION_ALREADY_EXISTS\020" + + "\n\022\026\n\022FUNCTION_NOT_FOUND\020\013\022\030\n\024NEWER_FUNCT" + + "ION_FOUND\020\014\022\032\n\026FUNCTION_NOT_IN_REGION\020\r\022" + + "\031\n\025SCHEMA_ALREADY_EXISTS\020\016\022\026\n\022NEWER_SCHE" + + "MA_FOUND\020\017\022\024\n\020SCHEMA_NOT_FOUND\020\020\022\030\n\024SCHE", + "MA_NOT_IN_REGION\020\021\022\032\n\026TABLES_EXIST_ON_SC" + + "HEMA\020\022\022\035\n\031UNALLOWED_SCHEMA_MUTATION\020\023\022%\n" + + "!AUTO_PARTITION_SEQUENCE_NOT_FOUND\020\024\022#\n\037" + + "CANNOT_COERCE_AUTO_PARTITION_ID\020\025\022\024\n\020TOO" + + "_MANY_INDEXES\020\026\022\037\n\033UNABLE_TO_CREATE_CHIL" + + "D_LINK\020\027\022!\n\035UNABLE_TO_UPDATE_PARENT_TABL" + + "E\020\0302\345\006\n\017MetaDataService\022/\n\010getTable\022\020.Ge" + + "tTableRequest\032\021.MetaDataResponse\0227\n\014getF" + + "unctions\022\024.GetFunctionsRequest\032\021.MetaDat" + + "aResponse\0221\n\tgetSchema\022\021.GetSchemaReques", + "t\032\021.MetaDataResponse\0225\n\013createTable\022\023.Cr" + + "eateTableRequest\032\021.MetaDataResponse\022;\n\016c" + + "reateFunction\022\026.CreateFunctionRequest\032\021." + + "MetaDataResponse\0227\n\014createSchema\022\024.Creat" + + "eSchemaRequest\032\021.MetaDataResponse\0221\n\tdro" + + "pTable\022\021.DropTableRequest\032\021.MetaDataResp" + + "onse\0223\n\ndropSchema\022\022.DropSchemaRequest\032\021" + + ".MetaDataResponse\0227\n\014dropFunction\022\024.Drop" + + "FunctionRequest\032\021.MetaDataResponse\0221\n\tad" + + "dColumn\022\021.AddColumnRequest\032\021.MetaDataRes", + "ponse\0223\n\ndropColumn\022\022.DropColumnRequest\032" + + "\021.MetaDataResponse\022?\n\020updateIndexState\022\030" + + ".UpdateIndexStateRequest\032\021.MetaDataRespo" + + "nse\0225\n\nclearCache\022\022.ClearCacheRequest\032\023." + + "ClearCacheResponse\0225\n\ngetVersion\022\022.GetVe" + + "rsionRequest\032\023.GetVersionResponse\022P\n\023cle" + + "arTableFromCache\022\033.ClearTableFromCacheRe" + + "quest\032\034.ClearTableFromCacheResponseBB\n(o" + + "rg.apache.phoenix.coprocessor.generatedB" + + "\016MetaDataProtosH\001\210\001\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -17756,13 +17937,13 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_SharedTableState_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SharedTableState_descriptor, - new java.lang.String[] { "TenantId", "SchemaName", "TableName", "Columns", "PhysicalNames", "ViewIndexId", }); + new java.lang.String[] { "TenantId", "SchemaName", "TableName", "Columns", "PhysicalNames", "ViewIndexId", "ViewIndexType", }); internal_static_MetaDataResponse_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_MetaDataResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_MetaDataResponse_descriptor, - new java.lang.String[] { "ReturnCode", "MutationTime", "Table", "TablesToDelete", "ColumnName", "FamilyName", "FunctionName", "Function", "SharedTablesToDelete", "Schema", "AutoPartitionNum", "ViewIndexId", }); + new java.lang.String[] { "ReturnCode", "MutationTime", "Table", "TablesToDelete", "ColumnName", "FamilyName", "FunctionName", "Function", "SharedTablesToDelete", "Schema", "AutoPartitionNum", "ViewIndexId", "ViewIndexType", }); internal_static_GetTableRequest_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_GetTableRequest_fieldAccessorTable = new diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java index ab61826755a..938ae1f19df 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java @@ -3495,15 +3495,15 @@ org.apache.phoenix.coprocessor.generated.PTableProtos.PTableOrBuilder getIndexes */ com.google.protobuf.ByteString getTenantId(); - // optional int32 viewIndexId = 21; + // optional int64 viewIndexId = 21; /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ boolean hasViewIndexId(); /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ - int getViewIndexId(); + long getViewIndexId(); // optional bytes indexType = 22; /** @@ -3694,6 +3694,16 @@ org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedCQCounterOrBuilder * optional int32 transactionProvider = 38; */ int getTransactionProvider(); + + // optional int32 viewIndexType = 39 [default = 5]; + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + boolean hasViewIndexType(); + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + int getViewIndexType(); } /** * Protobuf type {@code PTable} @@ -3859,7 +3869,7 @@ private PTable( } case 168: { bitField0_ |= 0x00010000; - viewIndexId_ = input.readInt32(); + viewIndexId_ = input.readInt64(); break; } case 178: { @@ -3950,6 +3960,11 @@ private PTable( transactionProvider_ = input.readInt32(); break; } + case 312: { + bitField1_ |= 0x00000002; + viewIndexType_ = input.readInt32(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -4395,19 +4410,19 @@ public com.google.protobuf.ByteString getTenantId() { return tenantId_; } - // optional int32 viewIndexId = 21; + // optional int64 viewIndexId = 21; public static final int VIEWINDEXID_FIELD_NUMBER = 21; - private int viewIndexId_; + private long viewIndexId_; /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00010000) == 0x00010000); } /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } @@ -4730,6 +4745,22 @@ public int getTransactionProvider() { return transactionProvider_; } + // optional int32 viewIndexType = 39 [default = 5]; + public static final int VIEWINDEXTYPE_FIELD_NUMBER = 39; + private int viewIndexType_; + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField1_ & 0x00000002) == 0x00000002); + } + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + private void initFields() { schemaNameBytes_ = com.google.protobuf.ByteString.EMPTY; tableNameBytes_ = com.google.protobuf.ByteString.EMPTY; @@ -4750,7 +4781,7 @@ private void initFields() { viewStatement_ = com.google.protobuf.ByteString.EMPTY; physicalNames_ = java.util.Collections.emptyList(); tenantId_ = com.google.protobuf.ByteString.EMPTY; - viewIndexId_ = 0; + viewIndexId_ = 0L; indexType_ = com.google.protobuf.ByteString.EMPTY; statsTimeStamp_ = 0L; storeNulls_ = false; @@ -4768,6 +4799,7 @@ private void initFields() { encodedCQCounters_ = java.util.Collections.emptyList(); useStatsForParallelization_ = false; transactionProvider_ = 0; + viewIndexType_ = 5; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -4893,7 +4925,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) output.writeBytes(20, tenantId_); } if (((bitField0_ & 0x00010000) == 0x00010000)) { - output.writeInt32(21, viewIndexId_); + output.writeInt64(21, viewIndexId_); } if (((bitField0_ & 0x00020000) == 0x00020000)) { output.writeBytes(22, indexType_); @@ -4946,6 +4978,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField1_ & 0x00000001) == 0x00000001)) { output.writeInt32(38, transactionProvider_); } + if (((bitField1_ & 0x00000002) == 0x00000002)) { + output.writeInt32(39, viewIndexType_); + } getUnknownFields().writeTo(output); } @@ -5038,7 +5073,7 @@ public int getSerializedSize() { } if (((bitField0_ & 0x00010000) == 0x00010000)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(21, viewIndexId_); + .computeInt64Size(21, viewIndexId_); } if (((bitField0_ & 0x00020000) == 0x00020000)) { size += com.google.protobuf.CodedOutputStream @@ -5108,6 +5143,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeInt32Size(38, transactionProvider_); } + if (((bitField1_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(39, viewIndexType_); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -5304,6 +5343,11 @@ public boolean equals(final java.lang.Object obj) { result = result && (getTransactionProvider() == other.getTransactionProvider()); } + result = result && (hasViewIndexType() == other.hasViewIndexType()); + if (hasViewIndexType()) { + result = result && (getViewIndexType() + == other.getViewIndexType()); + } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; @@ -5395,7 +5439,7 @@ public int hashCode() { } if (hasViewIndexId()) { hash = (37 * hash) + VIEWINDEXID_FIELD_NUMBER; - hash = (53 * hash) + getViewIndexId(); + hash = (53 * hash) + hashLong(getViewIndexId()); } if (hasIndexType()) { hash = (37 * hash) + INDEXTYPE_FIELD_NUMBER; @@ -5465,6 +5509,10 @@ public int hashCode() { hash = (37 * hash) + TRANSACTIONPROVIDER_FIELD_NUMBER; hash = (53 * hash) + getTransactionProvider(); } + if (hasViewIndexType()) { + hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexType(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -5623,7 +5671,7 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00020000); tenantId_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00040000); - viewIndexId_ = 0; + viewIndexId_ = 0L; bitField0_ = (bitField0_ & ~0x00080000); indexType_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00100000); @@ -5663,6 +5711,8 @@ public Builder clear() { bitField1_ = (bitField1_ & ~0x00000008); transactionProvider_ = 0; bitField1_ = (bitField1_ & ~0x00000010); + viewIndexType_ = 5; + bitField1_ = (bitField1_ & ~0x00000020); return this; } @@ -5857,6 +5907,10 @@ public org.apache.phoenix.coprocessor.generated.PTableProtos.PTable buildPartial to_bitField1_ |= 0x00000001; } result.transactionProvider_ = transactionProvider_; + if (((from_bitField1_ & 0x00000020) == 0x00000020)) { + to_bitField1_ |= 0x00000002; + } + result.viewIndexType_ = viewIndexType_; result.bitField0_ = to_bitField0_; result.bitField1_ = to_bitField1_; onBuilt(); @@ -6065,6 +6119,9 @@ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.PTableProtos.P if (other.hasTransactionProvider()) { setTransactionProvider(other.getTransactionProvider()); } + if (other.hasViewIndexType()) { + setViewIndexType(other.getViewIndexType()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -7323,35 +7380,35 @@ public Builder clearTenantId() { return this; } - // optional int32 viewIndexId = 21; - private int viewIndexId_ ; + // optional int64 viewIndexId = 21; + private long viewIndexId_ ; /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ public boolean hasViewIndexId() { return ((bitField0_ & 0x00080000) == 0x00080000); } /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ - public int getViewIndexId() { + public long getViewIndexId() { return viewIndexId_; } /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ - public Builder setViewIndexId(int value) { + public Builder setViewIndexId(long value) { bitField0_ |= 0x00080000; viewIndexId_ = value; onChanged(); return this; } /** - * optional int32 viewIndexId = 21; + * optional int64 viewIndexId = 21; */ public Builder clearViewIndexId() { bitField0_ = (bitField0_ & ~0x00080000); - viewIndexId_ = 0; + viewIndexId_ = 0L; onChanged(); return this; } @@ -8177,6 +8234,39 @@ public Builder clearTransactionProvider() { return this; } + // optional int32 viewIndexType = 39 [default = 5]; + private int viewIndexType_ = 5; + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public boolean hasViewIndexType() { + return ((bitField1_ & 0x00000020) == 0x00000020); + } + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public int getViewIndexType() { + return viewIndexType_; + } + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public Builder setViewIndexType(int value) { + bitField1_ |= 0x00000020; + viewIndexType_ = value; + onChanged(); + return this; + } + /** + * optional int32 viewIndexType = 39 [default = 5]; + */ + public Builder clearViewIndexType() { + bitField1_ = (bitField1_ & ~0x00000020); + viewIndexType_ = 5; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:PTable) } @@ -8846,7 +8936,7 @@ public Builder clearCounter() { "es\030\002 \003(\014\022\033\n\023guidePostsByteCount\030\003 \001(\003\022\025\n" + "\rkeyBytesCount\030\004 \001(\003\022\027\n\017guidePostsCount\030" + "\005 \001(\005\022!\n\013pGuidePosts\030\006 \001(\0132\014.PGuidePosts" + - "\"\255\007\n\006PTable\022\027\n\017schemaNameBytes\030\001 \002(\014\022\026\n\016" + + "\"\307\007\n\006PTable\022\027\n\017schemaNameBytes\030\001 \002(\014\022\026\n\016" + "tableNameBytes\030\002 \002(\014\022\036\n\ttableType\030\003 \002(\0162" + "\013.PTableType\022\022\n\nindexState\030\004 \001(\t\022\026\n\016sequ" + "enceNumber\030\005 \002(\003\022\021\n\ttimeStamp\030\006 \002(\003\022\023\n\013p" + @@ -8857,7 +8947,7 @@ public Builder clearCounter() { "me\030\016 \001(\014\022\022\n\ndisableWAL\030\017 \002(\010\022\023\n\013multiTen" + "ant\030\020 \002(\010\022\020\n\010viewType\030\021 \001(\014\022\025\n\rviewState" + "ment\030\022 \001(\014\022\025\n\rphysicalNames\030\023 \003(\014\022\020\n\010ten" + - "antId\030\024 \001(\014\022\023\n\013viewIndexId\030\025 \001(\005\022\021\n\tinde" + + "antId\030\024 \001(\014\022\023\n\013viewIndexId\030\025 \001(\003\022\021\n\tinde" + "xType\030\026 \001(\014\022\026\n\016statsTimeStamp\030\027 \001(\003\022\022\n\ns" + "toreNulls\030\030 \001(\010\022\027\n\017baseColumnCount\030\031 \001(\005" + "\022\036\n\026rowKeyOrderOptimizable\030\032 \001(\010\022\025\n\rtran" + @@ -8869,12 +8959,12 @@ public Builder clearCounter() { "eme\030\" \001(\014\022\026\n\016encodingScheme\030# \001(\014\022,\n\021enc" + "odedCQCounters\030$ \003(\0132\021.EncodedCQCounter\022" + "\"\n\032useStatsForParallelization\030% \001(\010\022\033\n\023t" + - "ransactionProvider\030& \001(\005\"6\n\020EncodedCQCou" + - "nter\022\021\n\tcolFamily\030\001 \002(\t\022\017\n\007counter\030\002 \002(\005" + - "*A\n\nPTableType\022\n\n\006SYSTEM\020\000\022\010\n\004USER\020\001\022\010\n\004", - "VIEW\020\002\022\t\n\005INDEX\020\003\022\010\n\004JOIN\020\004B@\n(org.apach" + - "e.phoenix.coprocessor.generatedB\014PTableP" + - "rotosH\001\210\001\001\240\001\001" + "ransactionProvider\030& \001(\005\022\030\n\rviewIndexTyp" + + "e\030\' \001(\005:\0015\"6\n\020EncodedCQCounter\022\021\n\tcolFam" + + "ily\030\001 \002(\t\022\017\n\007counter\030\002 \002(\005*A\n\nPTableType", + "\022\n\n\006SYSTEM\020\000\022\010\n\004USER\020\001\022\010\n\004VIEW\020\002\022\t\n\005INDE" + + "X\020\003\022\010\n\004JOIN\020\004B@\n(org.apache.phoenix.copr" + + "ocessor.generatedB\014PTableProtosH\001\210\001\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -8898,7 +8988,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_PTable_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PTable_descriptor, - new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", "TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", "BucketNum", "Columns", "Indexes", "IsImmutableRows", "DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", "ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", "IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", "RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", "IndexDisableTimestamp", "IsNamespaceMapped", "AutoParititonSeqName", "IsAppendOnlySchema", "ParentNameBytes", "StorageScheme", "EncodingScheme", "EncodedCQCounters", "UseStatsForParallelization", "TransactionProvider", }); + new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", "TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", "BucketNum", "Columns", "Indexes", "IsImmutableRows", "DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", "ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", "IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", "RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", "IndexDisableTimestamp", "IsNamespaceMapped", "AutoParititonSeqName", "IsAppendOnlySchema", "ParentNameBytes", "StorageScheme", "EncodingScheme", "EncodedCQCounters", "UseStatsForParallelization", "TransactionProvider", "ViewIndexType", }); internal_static_EncodedCQCounter_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_EncodedCQCounter_fieldAccessorTable = new diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java index f1b03f84cf2..fdca3342bc5 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java @@ -2157,6 +2157,16 @@ org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ColumnInfoOrBuilder * required int32 immutableStorageScheme = 21; */ int getImmutableStorageScheme(); + + // optional int32 viewIndexType = 22; + /** + * optional int32 viewIndexType = 22; + */ + boolean hasViewIndexType(); + /** + * optional int32 viewIndexType = 22; + */ + int getViewIndexType(); } /** * Protobuf type {@code IndexMaintainer} @@ -2350,6 +2360,11 @@ private IndexMaintainer( immutableStorageScheme_ = input.readInt32(); break; } + case 176: { + bitField0_ |= 0x00010000; + viewIndexType_ = input.readInt32(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -2834,6 +2849,22 @@ public int getImmutableStorageScheme() { return immutableStorageScheme_; } + // optional int32 viewIndexType = 22; + public static final int VIEWINDEXTYPE_FIELD_NUMBER = 22; + private int viewIndexType_; + /** + * optional int32 viewIndexType = 22; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00010000) == 0x00010000); + } + /** + * optional int32 viewIndexType = 22; + */ + public int getViewIndexType() { + return viewIndexType_; + } + private void initFields() { saltBuckets_ = 0; isMultiTenant_ = false; @@ -2856,6 +2887,7 @@ private void initFields() { indexedColumnInfo_ = java.util.Collections.emptyList(); encodingScheme_ = 0; immutableStorageScheme_ = 0; + viewIndexType_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -3016,6 +3048,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00008000) == 0x00008000)) { output.writeInt32(21, immutableStorageScheme_); } + if (((bitField0_ & 0x00010000) == 0x00010000)) { + output.writeInt32(22, viewIndexType_); + } getUnknownFields().writeTo(output); } @@ -3114,6 +3149,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeInt32Size(21, immutableStorageScheme_); } + if (((bitField0_ & 0x00010000) == 0x00010000)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(22, viewIndexType_); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -3227,6 +3266,11 @@ public boolean equals(final java.lang.Object obj) { result = result && (getImmutableStorageScheme() == other.getImmutableStorageScheme()); } + result = result && (hasViewIndexType() == other.hasViewIndexType()); + if (hasViewIndexType()) { + result = result && (getViewIndexType() + == other.getViewIndexType()); + } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; @@ -3324,6 +3368,10 @@ public int hashCode() { hash = (37 * hash) + IMMUTABLESTORAGESCHEME_FIELD_NUMBER; hash = (53 * hash) + getImmutableStorageScheme(); } + if (hasViewIndexType()) { + hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexType(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -3500,6 +3548,8 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00080000); immutableStorageScheme_ = 0; bitField0_ = (bitField0_ & ~0x00100000); + viewIndexType_ = 0; + bitField0_ = (bitField0_ & ~0x00200000); return this; } @@ -3637,6 +3687,10 @@ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.IndexMaintai to_bitField0_ |= 0x00008000; } result.immutableStorageScheme_ = immutableStorageScheme_; + if (((from_bitField0_ & 0x00200000) == 0x00200000)) { + to_bitField0_ |= 0x00010000; + } + result.viewIndexType_ = viewIndexType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -3815,6 +3869,9 @@ public Builder mergeFrom(org.apache.phoenix.coprocessor.generated.ServerCachingP if (other.hasImmutableStorageScheme()) { setImmutableStorageScheme(other.getImmutableStorageScheme()); } + if (other.hasViewIndexType()) { + setViewIndexType(other.getViewIndexType()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -5579,6 +5636,39 @@ public Builder clearImmutableStorageScheme() { return this; } + // optional int32 viewIndexType = 22; + private int viewIndexType_ ; + /** + * optional int32 viewIndexType = 22; + */ + public boolean hasViewIndexType() { + return ((bitField0_ & 0x00200000) == 0x00200000); + } + /** + * optional int32 viewIndexType = 22; + */ + public int getViewIndexType() { + return viewIndexType_; + } + /** + * optional int32 viewIndexType = 22; + */ + public Builder setViewIndexType(int value) { + bitField0_ |= 0x00200000; + viewIndexType_ = value; + onChanged(); + return this; + } + /** + * optional int32 viewIndexType = 22; + */ + public Builder clearViewIndexType() { + bitField0_ = (bitField0_ & ~0x00200000); + viewIndexType_ = 0; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:IndexMaintainer) } @@ -8615,7 +8705,7 @@ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServer "ength\030\003 \002(\005\"4\n\017ColumnReference\022\016\n\006family" + "\030\001 \002(\014\022\021\n\tqualifier\030\002 \002(\014\"4\n\nColumnInfo\022" + "\022\n\nfamilyName\030\001 \001(\t\022\022\n\ncolumnName\030\002 \002(\t\"" + - "\306\005\n\017IndexMaintainer\022\023\n\013saltBuckets\030\001 \002(\005" + + "\335\005\n\017IndexMaintainer\022\023\n\013saltBuckets\030\001 \002(\005" + "\022\025\n\risMultiTenant\030\002 \002(\010\022\023\n\013viewIndexId\030\003" + " \001(\014\022(\n\016indexedColumns\030\004 \003(\0132\020.ColumnRef" + "erence\022 \n\030indexedColumnTypeOrdinal\030\005 \003(\005", @@ -8632,23 +8722,23 @@ public org.apache.phoenix.coprocessor.generated.ServerCachingProtos.RemoveServer "ed\030\020 \002(\010\022\033\n\023indexRowKeyByteSize\030\021 \002(\005\022\021\n" + "\timmutable\030\022 \002(\010\022&\n\021indexedColumnInfo\030\023 " + "\003(\0132\013.ColumnInfo\022\026\n\016encodingScheme\030\024 \002(\005" + - "\022\036\n\026immutableStorageScheme\030\025 \002(\005\"\334\001\n\025Add" + - "ServerCacheRequest\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007" + - "cacheId\030\002 \002(\014\022)\n\010cachePtr\030\003 \002(\0132\027.Immuta" + - "bleBytesWritable\022)\n\014cacheFactory\030\004 \002(\0132\023" + - ".ServerCacheFactory\022\017\n\007txState\030\005 \001(\014\022\"\n\032" + - "hasProtoBufIndexMaintainer\030\006 \001(\010\022\025\n\rclie" + - "ntVersion\030\007 \001(\005\"(\n\026AddServerCacheRespons", - "e\022\016\n\006return\030\001 \002(\010\"=\n\030RemoveServerCacheRe" + - "quest\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007cacheId\030\002 \002(\014" + - "\"+\n\031RemoveServerCacheResponse\022\016\n\006return\030" + - "\001 \002(\0102\245\001\n\024ServerCachingService\022A\n\016addSer" + - "verCache\022\026.AddServerCacheRequest\032\027.AddSe" + - "rverCacheResponse\022J\n\021removeServerCache\022\031" + - ".RemoveServerCacheRequest\032\032.RemoveServer" + - "CacheResponseBG\n(org.apache.phoenix.copr" + - "ocessor.generatedB\023ServerCachingProtosH\001" + - "\210\001\001\240\001\001" + "\022\036\n\026immutableStorageScheme\030\025 \002(\005\022\025\n\rview" + + "IndexType\030\026 \001(\005\"\334\001\n\025AddServerCacheReques" + + "t\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007cacheId\030\002 \002(\014\022)\n\010" + + "cachePtr\030\003 \002(\0132\027.ImmutableBytesWritable\022" + + ")\n\014cacheFactory\030\004 \002(\0132\023.ServerCacheFacto" + + "ry\022\017\n\007txState\030\005 \001(\014\022\"\n\032hasProtoBufIndexM" + + "aintainer\030\006 \001(\010\022\025\n\rclientVersion\030\007 \001(\005\"(", + "\n\026AddServerCacheResponse\022\016\n\006return\030\001 \002(\010" + + "\"=\n\030RemoveServerCacheRequest\022\020\n\010tenantId" + + "\030\001 \001(\014\022\017\n\007cacheId\030\002 \002(\014\"+\n\031RemoveServerC" + + "acheResponse\022\016\n\006return\030\001 \002(\0102\245\001\n\024ServerC" + + "achingService\022A\n\016addServerCache\022\026.AddSer" + + "verCacheRequest\032\027.AddServerCacheResponse" + + "\022J\n\021removeServerCache\022\031.RemoveServerCach" + + "eRequest\032\032.RemoveServerCacheResponseBG\n(" + + "org.apache.phoenix.coprocessor.generated" + + "B\023ServerCachingProtosH\001\210\001\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -8678,7 +8768,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_IndexMaintainer_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IndexMaintainer_descriptor, - new java.lang.String[] { "SaltBuckets", "IsMultiTenant", "ViewIndexId", "IndexedColumns", "IndexedColumnTypeOrdinal", "DataTableColRefForCoveredColumns", "IndexTableColRefForCoveredColumns", "IsLocalIndex", "IndexTableName", "RowKeyOrderOptimizable", "DataTableEmptyKeyValueColFamily", "EmptyKeyValueColFamily", "IndexedExpressions", "RowKeyMetadata", "NumDataTableColFamilies", "IndexWalDisabled", "IndexRowKeyByteSize", "Immutable", "IndexedColumnInfo", "EncodingScheme", "ImmutableStorageScheme", }); + new java.lang.String[] { "SaltBuckets", "IsMultiTenant", "ViewIndexId", "IndexedColumns", "IndexedColumnTypeOrdinal", "DataTableColRefForCoveredColumns", "IndexTableColRefForCoveredColumns", "IsLocalIndex", "IndexTableName", "RowKeyOrderOptimizable", "DataTableEmptyKeyValueColFamily", "EmptyKeyValueColFamily", "IndexedExpressions", "RowKeyMetadata", "NumDataTableColFamilies", "IndexWalDisabled", "IndexRowKeyByteSize", "Immutable", "IndexedColumnInfo", "EncodingScheme", "ImmutableStorageScheme", "ViewIndexType", }); internal_static_AddServerCacheRequest_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_AddServerCacheRequest_fieldAccessorTable = new diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java index 2f20af290cf..3416b212397 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java @@ -101,6 +101,7 @@ import org.apache.phoenix.schema.tuple.BaseTuple; import org.apache.phoenix.schema.tuple.ValueGetterTuple; import org.apache.phoenix.schema.types.PDataType; +import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.BitSet; import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.EncodedColumnsUtil; @@ -314,6 +315,7 @@ private static List deserialize(byte[] buf, int offset, int len } private byte[] viewIndexId; + private PDataType viewIndexType; private boolean isMultiTenant; // indexed expressions that are not present in the row key of the data table, the expression can also refer to a regular column private List indexedExpressions; @@ -371,7 +373,8 @@ private IndexMaintainer(final PTable dataTable, final PTable index, PhoenixConne this(dataTable.getRowKeySchema(), dataTable.getBucketNum() != null); this.rowKeyOrderOptimizable = index.rowKeyOrderOptimizable(); this.isMultiTenant = dataTable.isMultiTenant(); - this.viewIndexId = index.getViewIndexId() == null ? null : MetaDataUtil.getViewIndexIdDataType().toBytes(index.getViewIndexId()); + this.viewIndexId = index.getViewIndexId() == null ? null : index.getViewIndexType().toBytes(index.getViewIndexId()); + this.viewIndexType = index.getViewIndexType(); this.isLocalIndex = index.getIndexType() == IndexType.LOCAL; this.encodingScheme = index.getEncodingScheme(); @@ -823,7 +826,7 @@ public boolean isNullable() { @Override public PDataType getDataType() { - return MetaDataUtil.getViewIndexIdDataType(); + return viewIndexType; } @Override @@ -1223,7 +1226,9 @@ public void readFields(DataInput input) throws IOException { boolean hasViewIndexId = encodedIndexedColumnsAndViewId < 0; if (hasViewIndexId) { // Fixed length - viewIndexId = new byte[MetaDataUtil.getViewIndexIdDataType().getByteSize()]; + //Use legacy viewIndexIdType for clients older than 4.10 release + viewIndexId = new byte[MetaDataUtil.getLegacyViewIndexIdDataType().getByteSize()]; + viewIndexType = MetaDataUtil.getLegacyViewIndexIdDataType(); input.readFully(viewIndexId); } int nIndexedColumns = Math.abs(encodedIndexedColumnsAndViewId) - 1; @@ -1340,6 +1345,9 @@ public static IndexMaintainer fromProto(ServerCachingProtos.IndexMaintainer prot maintainer.nIndexSaltBuckets = proto.getSaltBuckets(); maintainer.isMultiTenant = proto.getIsMultiTenant(); maintainer.viewIndexId = proto.hasViewIndexId() ? proto.getViewIndexId().toByteArray() : null; + maintainer.viewIndexType = proto.hasViewIndexType() + ? PDataType.fromTypeId(proto.getViewIndexType()) + : MetaDataUtil.getLegacyViewIndexIdDataType(); List indexedColumnsList = proto.getIndexedColumnsList(); maintainer.indexedColumns = new HashSet(indexedColumnsList.size()); for (ServerCachingProtos.ColumnReference colRefFromProto : indexedColumnsList) { @@ -1459,6 +1467,7 @@ public static ServerCachingProtos.IndexMaintainer toProto(IndexMaintainer mainta builder.setIsMultiTenant(maintainer.isMultiTenant); if (maintainer.viewIndexId != null) { builder.setViewIndexId(ByteStringer.wrap(maintainer.viewIndexId)); + builder.setViewIndexType(maintainer.viewIndexType.getSqlType()); } for (ColumnReference colRef : maintainer.indexedColumns) { ServerCachingProtos.ColumnReference.Builder cRefBuilder = ServerCachingProtos.ColumnReference.newBuilder(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java index c87ad985e99..92c941d0bd1 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java @@ -312,7 +312,7 @@ private Collection getLocalIndexNames(HTableInterfaceReference new HashMap(); for (PTable index : indexes) { if (localIndex == null) localIndex = index; - localIndexNames.put(new ImmutableBytesWritable(MetaDataUtil.getViewIndexIdDataType().toBytes( + localIndexNames.put(new ImmutableBytesWritable(index.getViewIndexType().toBytes( index.getViewIndexId())), index.getName().getString()); } if (localIndex == null) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java index 1a22f608603..2671044a78f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java @@ -47,6 +47,7 @@ import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.schema.types.PInteger; +import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.ScanUtil; import org.apache.phoenix.util.StringUtil; @@ -204,15 +205,19 @@ private void appendPKColumnValue(StringBuilder buf, byte[] range, Boolean isNull range = ptr.get(); } if (changeViewIndexId) { - Short s = (Short) type.toObject(range); - s = (short) (s + (-Short.MAX_VALUE)); - buf.append(s.toString()); + buf.append(getViewIndexValue(type, range).toString()); } else { Format formatter = context.getConnection().getFormatter(type); buf.append(type.toStringLiteral(range, formatter)); } } - + + private Long getViewIndexValue(PDataType type, byte[] range) { + boolean useLongViewIndex = MetaDataUtil.getViewIndexIdDataType().equals(type); + Object s = type.toObject(range); + return (useLongViewIndex ? (Long) s : (Short) s) - (useLongViewIndex ? Long.MAX_VALUE : Short.MAX_VALUE); + } + private static class RowKeyValueIterator implements Iterator { private final RowKeySchema schema; private ImmutableBytesWritable ptr = new ImmutableBytesWritable(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index ed6c7ca8d55..632d765d581 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -222,6 +222,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData { public static final byte[] IS_VIEW_REFERENCED_BYTES = Bytes.toBytes(IS_VIEW_REFERENCED); public static final String VIEW_INDEX_ID = "VIEW_INDEX_ID"; public static final byte[] VIEW_INDEX_ID_BYTES = Bytes.toBytes(VIEW_INDEX_ID); + public static final String VIEW_INDEX_ID_DATA_TYPE = "VIEW_INDEX_ID_DATA_TYPE"; + public static final byte[] VIEW_INDEX_ID_DATA_TYPE_BYTES = Bytes.toBytes(VIEW_INDEX_ID_DATA_TYPE); public static final String BASE_COLUMN_COUNT = "BASE_COLUMN_COUNT"; public static final byte[] BASE_COLUMN_COUNT_BYTES = Bytes.toBytes(BASE_COLUMN_COUNT); public static final String IS_ROW_TIMESTAMP = "IS_ROW_TIMESTAMP"; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 7c5dc5efd21..6e27f2a0f4b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -3031,6 +3031,14 @@ protected PhoenixConnection upgradeSystemCatalogIfRequired(PhoenixConnection met addViewIndexToParentLinks(metaConnection); moveChildLinks(metaConnection); } + if (currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_5_1_0) { + metaConnection = addColumnsIfNotExists( + metaConnection, + PhoenixDatabaseMetaData.SYSTEM_CATALOG, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_5_1_0, + PhoenixDatabaseMetaData.VIEW_INDEX_ID_DATA_TYPE + " " + + PInteger.INSTANCE.getSqlTypeName()); + } return metaConnection; } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java index 3fbcca0f6c9..6623e617a1d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java @@ -300,7 +300,7 @@ public MetaDataMutationResult createTable(List tableMetaData, byte[] p if (!allocateIndexId) { return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, 0, null); } else { - return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, 0, null, Short.MIN_VALUE); + return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, 0, null, Long.MIN_VALUE, MetaDataUtil.getViewIndexIdDataType()); } } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java index 208b96bc6dc..ab78eb91a92 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java @@ -192,7 +192,8 @@ public enum JoinType {INNER, LEFT_OUTER} DISABLE_WAL + " BOOLEAN,\n" + MULTI_TENANT + " BOOLEAN,\n" + VIEW_TYPE + " UNSIGNED_TINYINT,\n" + - VIEW_INDEX_ID + " SMALLINT,\n" + + VIEW_INDEX_ID + " BIGINT,\n" + + VIEW_INDEX_ID_DATA_TYPE + " INTEGER,\n" + // Column metadata (will be null for table row) DATA_TYPE + " INTEGER," + COLUMN_SIZE + " INTEGER," + @@ -370,4 +371,4 @@ public enum JoinType {INNER, LEFT_OUTER} ColumnFamilyDescriptorBuilder.KEEP_DELETED_CELLS + "=%s,\n" + PhoenixDatabaseMetaData.TRANSACTIONAL + "=" + Boolean.FALSE; -} \ No newline at end of file +} diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java index d1b8f1ea20b..50bb722d76e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java @@ -23,6 +23,7 @@ import org.apache.phoenix.hbase.index.util.KeyValueBuilder; import org.apache.phoenix.index.IndexMaintainer; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.transaction.TransactionFactory; public class DelegateTable implements PTable { @@ -207,10 +208,15 @@ public String getViewStatement() { } @Override - public Short getViewIndexId() { + public Long getViewIndexId() { return delegate.getViewIndexId(); } + @Override + public PDataType getViewIndexType() { + return delegate.getViewIndexType(); + } + @Override public PTableKey getKey() { return delegate.getKey(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 2ee3c23c45d..54d455b505d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -90,6 +90,7 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_CONSTANT; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_STATEMENT; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_TYPE; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_INDEX_ID_DATA_TYPE; import static org.apache.phoenix.query.QueryConstants.BASE_TABLE_BASE_COLUMN_COUNT; import static org.apache.phoenix.query.QueryConstants.DEFAULT_COLUMN_FAMILY; import static org.apache.phoenix.query.QueryConstants.ENCODED_CQ_COUNTER_INITIAL_VALUE; @@ -301,8 +302,9 @@ public class MetaDataClient { GUIDE_POSTS_WIDTH + "," + IMMUTABLE_STORAGE_SCHEME + "," + ENCODING_SCHEME + "," + - USE_STATS_FOR_PARALLELIZATION + - ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + USE_STATS_FOR_PARALLELIZATION +"," + + VIEW_INDEX_ID_DATA_TYPE + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; private static final String CREATE_SCHEMA = "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_CATALOG_TABLE + "\"( " + TABLE_SCHEM + "," + TABLE_NAME + ") VALUES (?,?)"; @@ -1061,7 +1063,7 @@ private PColumn newColumn(int position, ColumnDef def, PrimaryKeyConstraint pkCo } } - public MutationState createTable(CreateTableStatement statement, byte[][] splits, PTable parent, String viewStatement, ViewType viewType, byte[][] viewColumnConstants, BitSet isViewColumnReferenced) throws SQLException { + public MutationState createTable(CreateTableStatement statement, byte[][] splits, PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexType, byte[][] viewColumnConstants, BitSet isViewColumnReferenced) throws SQLException { TableName tableName = statement.getTableName(); Map tableProps = Maps.newHashMapWithExpectedSize(statement.getProps().size()); Map commonFamilyProps = Maps.newHashMapWithExpectedSize(statement.getProps().size() + 1); @@ -1122,7 +1124,7 @@ public MutationState createTable(CreateTableStatement statement, byte[][] splits true, NamedTableNode.create(statement.getTableName()), statement.getTableType()); } } - table = createTableInternal(statement, splits, parent, viewStatement, viewType, viewColumnConstants, isViewColumnReferenced, false, null, null, tableProps, commonFamilyProps); + table = createTableInternal(statement, splits, parent, viewStatement, viewType, viewIndexType, viewColumnConstants, isViewColumnReferenced, false, null, null, tableProps, commonFamilyProps); if (table == null || table.getType() == PTableType.VIEW /*|| table.isTransactional()*/) { return new MutationState(0, 0, connection); @@ -1676,7 +1678,7 @@ public MutationState createIndex(CreateIndexStatement statement, byte[][] splits PrimaryKeyConstraint pk = FACTORY.primaryKey(null, allPkColumns); tableProps.put(MetaDataUtil.DATA_TABLE_NAME_PROP_NAME, dataTable.getName().getString()); CreateTableStatement tableStatement = FACTORY.createTable(indexTableName, statement.getProps(), columnDefs, pk, statement.getSplitNodes(), PTableType.INDEX, statement.ifNotExists(), null, null, statement.getBindCount(), null); - table = createTableInternal(tableStatement, splits, dataTable, null, null, null, null, allocateIndexId, statement.getIndexType(), asyncCreatedDate, tableProps, commonFamilyProps); + table = createTableInternal(tableStatement, splits, dataTable, null, null, MetaDataUtil.getViewIndexIdDataType(),null, null, allocateIndexId, statement.getIndexType(), asyncCreatedDate, tableProps, commonFamilyProps); break; } catch (ConcurrentTableMutationException e) { // Can happen if parent data table changes while above is in progress if (numRetries<5) { @@ -1890,7 +1892,7 @@ private void deleteCell(String tenantId, String schemaName, String tableName, St } private PTable createTableInternal(CreateTableStatement statement, byte[][] splits, - final PTable parent, String viewStatement, ViewType viewType, + final PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexType, final byte[][] viewColumnConstants, final BitSet isViewColumnReferenced, boolean allocateIndexId, IndexType indexType, Date asyncCreatedDate, Map tableProps, @@ -2578,7 +2580,7 @@ else if (!SchemaUtil.isSystemTable(Bytes.toBytes(SchemaUtil.getTableName(schemaN Collections.emptyList(), isImmutableRows, Collections.emptyList(), defaultFamilyName == null ? null : PNameFactory.newName(defaultFamilyName), null, - Boolean.TRUE.equals(disableWAL), false, false, null, null, indexType, true, null, 0, 0L, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, PTable.EncodedCQCounter.NULL_COUNTER, true); + Boolean.TRUE.equals(disableWAL), false, false, null, viewIndexType, null, indexType, true, null, 0, 0L, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema, ONE_CELL_PER_COLUMN, NON_ENCODED_QUALIFIERS, PTable.EncodedCQCounter.NULL_COUNTER, true); connection.addTable(table, MetaDataProtocol.MIN_TABLE_TIMESTAMP); } @@ -2743,6 +2745,7 @@ public boolean isViewReferenced() { } else { tableUpsert.setBoolean(28, useStatsForParallelizationProp); } + tableUpsert.setInt(29, Types.BIGINT); tableUpsert.execute(); if (asyncCreatedDate != null) { @@ -2856,7 +2859,7 @@ public boolean isViewReferenced() { PTable.INITIAL_SEQ_NUM, pkName == null ? null : PNameFactory.newName(pkName), saltBucketNum, columns.values(), parent == null ? null : parent.getSchemaName(), parent == null ? null : parent.getTableName(), Collections.emptyList(), isImmutableRows, physicalNames, defaultFamilyName == null ? null : PNameFactory.newName(defaultFamilyName), viewStatement, Boolean.TRUE.equals(disableWAL), multiTenant, storeNulls, viewType, - result.getViewIndexId(), indexType, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, 0L, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema, immutableStorageScheme, encodingScheme, cqCounterToBe, useStatsForParallelizationProp); + viewIndexType, result.getViewIndexId(), indexType, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, 0L, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema, immutableStorageScheme, encodingScheme, cqCounterToBe, useStatsForParallelizationProp); result = new MetaDataMutationResult(code, result.getMutationTime(), table, true); addTableToCache(result); return table; @@ -3918,7 +3921,7 @@ else if (table.isAppendOnlySchema()) { PTableImpl viewIndexTable = new PTableImpl(sharedTableState.getTenantId(), sharedTableState.getSchemaName(), sharedTableState.getTableName(), ts, table.getColumnFamilies(), sharedTableState.getColumns(), - sharedTableState.getPhysicalNames(), sharedTableState.getViewIndexId(), + sharedTableState.getPhysicalNames(), sharedTableState.getViewIndexType(), sharedTableState.getViewIndexId(), table.isMultiTenant(), table.isNamespaceMapped(), table.getImmutableStorageScheme(), table.getEncodingScheme(), table.getEncodedCQCounter(), table.useStatsForParallelization()); TableRef indexTableRef = new TableRef(viewIndexTable); PName indexTableTenantId = sharedTableState.getTenantId(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java index bb81d7652ee..162317542c8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java @@ -700,7 +700,8 @@ interface QualifierEncoderDecoder { ViewType getViewType(); String getViewStatement(); - Short getViewIndexId(); + Long getViewIndexId(); + PDataType getViewIndexType(); PTableKey getKey(); IndexType getIndexType(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java index eccb2893ad1..17b788cf897 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java @@ -69,10 +69,12 @@ import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.schema.types.PDouble; import org.apache.phoenix.schema.types.PFloat; +import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.schema.types.PVarchar; import org.apache.phoenix.transaction.TransactionFactory; import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.EncodedColumnsUtil; +import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.SizedUtil; @@ -138,7 +140,8 @@ public class PTableImpl implements PTable { private boolean storeNulls; private TransactionFactory.Provider transactionProvider; private ViewType viewType; - private Short viewIndexId; + private PDataType viewIndexType; + private Long viewIndexId; private int estimatedSize; private IndexType indexType; private int baseColumnCount; @@ -214,7 +217,7 @@ public PTableImpl(PName tenantId, String schemaName, String tableName, long time // For indexes stored in shared physical tables public PTableImpl(PName tenantId, PName schemaName, PName tableName, long timestamp, List families, - List columns, List physicalNames, Short viewIndexId, boolean multiTenant, boolean isNamespaceMpped, ImmutableStorageScheme storageScheme, QualifierEncodingScheme qualifierEncodingScheme, + List columns, List physicalNames,PDataType viewIndexType, Long viewIndexId, boolean multiTenant, boolean isNamespaceMpped, ImmutableStorageScheme storageScheme, QualifierEncodingScheme qualifierEncodingScheme, EncodedCQCounter encodedCQCounter, Boolean useStatsForParallelization) throws SQLException { this.pkColumns = this.allColumns = Collections.emptyList(); this.rowKeySchema = RowKeySchema.EMPTY_SCHEMA; @@ -228,7 +231,7 @@ public PTableImpl(PName tenantId, PName schemaName, PName tableName, long timest this.families = families; init(tenantId, this.schemaName, this.tableName, PTableType.INDEX, state, timeStamp, sequenceNumber, pkName, bucketNum, columns, this.schemaName, parentTableName, indexes, isImmutableRows, physicalNames, defaultFamilyName, - null, disableWAL, multiTenant, storeNulls, viewType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, + null, disableWAL, multiTenant, storeNulls, viewType, viewIndexType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, indexDisableTimestamp, isNamespaceMpped, null, false, storageScheme, qualifierEncodingScheme, encodedCQCounter, useStatsForParallelization); } @@ -293,7 +296,8 @@ public static PTableImpl makePTable(PTable view, PTable baseTable, Collection columns, PName dataSchemaName, PName dataTableName, List indexes, boolean isImmutableRows, List physicalNames, PName defaultFamilyName, String viewExpression, - boolean disableWAL, boolean multiTenant, boolean storeNulls, ViewType viewType, Short viewIndexId, + boolean disableWAL, boolean multiTenant, boolean storeNulls, ViewType viewType, PDataType viewIndexType, Long viewIndexId, IndexType indexType, boolean rowKeyOrderOptimizable, TransactionFactory.Provider transactionProvider, long updateCacheFrequency, long indexDisableTimestamp, boolean isNamespaceMapped, String autoPartitionSeqName, boolean isAppendOnlySchema, ImmutableStorageScheme storageScheme, @@ -348,7 +352,7 @@ public static PTableImpl makePTable(PName tenantId, PName schemaName, PName tabl Boolean useStatsForParallelization) throws SQLException { return new PTableImpl(tenantId, schemaName, tableName, type, state, timeStamp, sequenceNumber, pkName, bucketNum, columns, dataSchemaName, dataTableName, indexes, isImmutableRows, physicalNames, - defaultFamilyName, viewExpression, disableWAL, multiTenant, storeNulls, viewType, viewIndexId, + defaultFamilyName, viewExpression, disableWAL, multiTenant, storeNulls, viewType, viewIndexType, viewIndexId, indexType, QueryConstants.BASE_TABLE_BASE_COLUMN_COUNT, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, indexDisableTimestamp, isNamespaceMapped, autoPartitionSeqName, isAppendOnlySchema, storageScheme, qualifierEncodingScheme, encodedCQCounter, @@ -359,7 +363,7 @@ public static PTableImpl makePTable(PName tenantId, PName schemaName, PName tabl PIndexState state, long timeStamp, long sequenceNumber, PName pkName, Integer bucketNum, Collection columns, PName dataSchemaName, PName dataTableName, List indexes, boolean isImmutableRows, List physicalNames, PName defaultFamilyName, String viewExpression, - boolean disableWAL, boolean multiTenant, boolean storeNulls, ViewType viewType, Short viewIndexId, + boolean disableWAL, boolean multiTenant, boolean storeNulls, ViewType viewType, PDataType viewIndexType, Long viewIndexId, IndexType indexType, boolean rowKeyOrderOptimizable, TransactionFactory.Provider transactionProvider, long updateCacheFrequency, int baseColumnCount, long indexDisableTimestamp, boolean isNamespaceMapped, String autoPartitionSeqName, boolean isAppendOnlySchema, ImmutableStorageScheme storageScheme, @@ -367,7 +371,7 @@ public static PTableImpl makePTable(PName tenantId, PName schemaName, PName tabl Boolean useStatsForParallelization) throws SQLException { return new PTableImpl(tenantId, schemaName, tableName, type, state, timeStamp, sequenceNumber, pkName, bucketNum, columns, dataSchemaName, dataTableName, indexes, isImmutableRows, physicalNames, - defaultFamilyName, viewExpression, disableWAL, multiTenant, storeNulls, viewType, viewIndexId, + defaultFamilyName, viewExpression, disableWAL, multiTenant, storeNulls, viewType,viewIndexType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, indexDisableTimestamp, isNamespaceMapped, autoPartitionSeqName, isAppendOnlySchema, storageScheme, qualifierEncodingScheme, encodedCQCounter, useStatsForParallelization); @@ -380,7 +384,7 @@ private PTableImpl(PTable table, boolean rowKeyOrderOptimizable, PIndexState sta init(tenantId, schemaName, tableName, type, state, timeStamp, sequenceNumber, table.getPKName(), table.getBucketNum(), columns, table.getParentSchemaName(), table.getParentTableName(), indexes, table.isImmutableRows(), table.getPhysicalNames(), defaultFamily, viewStatement, table.isWALDisabled(), - table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), + table.isMultiTenant(), table.getStoreNulls(), table.getViewType(), table.getViewIndexType(), table.getViewIndexId(), table.getIndexType(), baseTableColumnCount, rowKeyOrderOptimizable, table.getTransactionProvider(), updateCacheFrequency, table.getIndexDisableTimestamp(), table.isNamespaceMapped(), table.getAutoPartitionSeqName(), table.isAppendOnlySchema(), table.getImmutableStorageScheme(), @@ -391,13 +395,13 @@ private PTableImpl(PName tenantId, PName schemaName, PName tableName, PTableType long timeStamp, long sequenceNumber, PName pkName, Integer bucketNum, Collection columns, PName parentSchemaName, PName parentTableName, List indexes, boolean isImmutableRows, List physicalNames, PName defaultFamilyName, String viewExpression, boolean disableWAL, boolean multiTenant, - boolean storeNulls, ViewType viewType, Short viewIndexId, IndexType indexType, + boolean storeNulls, ViewType viewType, PDataType viewIndexType, Long viewIndexId, IndexType indexType, int baseColumnCount, boolean rowKeyOrderOptimizable, TransactionFactory.Provider transactionProvider, long updateCacheFrequency, long indexDisableTimestamp, boolean isNamespaceMapped, String autoPartitionSeqName, boolean isAppendOnlySchema, ImmutableStorageScheme storageScheme, QualifierEncodingScheme qualifierEncodingScheme, EncodedCQCounter encodedCQCounter, Boolean useStatsForParallelization) throws SQLException { init(tenantId, schemaName, tableName, type, state, timeStamp, sequenceNumber, pkName, bucketNum, columns, parentSchemaName, parentTableName, indexes, isImmutableRows, physicalNames, defaultFamilyName, - viewExpression, disableWAL, multiTenant, storeNulls, viewType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, + viewExpression, disableWAL, multiTenant, storeNulls, viewType, viewIndexType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, indexDisableTimestamp, isNamespaceMapped, autoPartitionSeqName, isAppendOnlySchema, storageScheme, qualifierEncodingScheme, encodedCQCounter, useStatsForParallelization); } @@ -431,7 +435,7 @@ public int getEstimatedSize() { private void init(PName tenantId, PName schemaName, PName tableName, PTableType type, PIndexState state, long timeStamp, long sequenceNumber, PName pkName, Integer bucketNum, Collection columns, PName parentSchemaName, PName parentTableName, List indexes, boolean isImmutableRows, List physicalNames, PName defaultFamilyName, String viewExpression, boolean disableWAL, - boolean multiTenant, boolean storeNulls, ViewType viewType, Short viewIndexId, + boolean multiTenant, boolean storeNulls, ViewType viewType,PDataType viewIndexType, Long viewIndexId, IndexType indexType , int baseColumnCount, boolean rowKeyOrderOptimizable, TransactionFactory.Provider transactionProvider, long updateCacheFrequency, long indexDisableTimestamp, boolean isNamespaceMapped, String autoPartitionSeqName, boolean isAppendOnlySchema, ImmutableStorageScheme storageScheme, QualifierEncodingScheme qualifierEncodingScheme, EncodedCQCounter encodedCQCounter, Boolean useStatsForParallelization) throws SQLException { @@ -462,6 +466,7 @@ private void init(PName tenantId, PName schemaName, PName tableName, PTableType this.multiTenant = multiTenant; this.storeNulls = storeNulls; this.viewType = viewType; + this.viewIndexType = viewIndexType; this.viewIndexId = viewIndexId; this.indexType = indexType; this.transactionProvider = transactionProvider; @@ -1201,10 +1206,15 @@ public boolean isWALDisabled() { } @Override - public Short getViewIndexId() { + public Long getViewIndexId() { return viewIndexId; } + @Override + public PDataType getViewIndexType() { + return viewIndexType; + } + @Override public PName getTenantId() { return tenantId; @@ -1233,10 +1243,13 @@ public static PTable createFromProto(PTableProtos.PTable table) { if (table.hasIndexState()) { indexState = PIndexState.fromSerializedValue(table.getIndexState()); } - Short viewIndexId = null; - if(table.hasViewIndexId()){ - viewIndexId = (short)table.getViewIndexId(); + Long viewIndexId = null; + if (table.hasViewIndexId()) { + viewIndexId = table.getViewIndexId(); } + PDataType viewIndexType = table.hasViewIndexType() + ? PDataType.fromTypeId(table.getViewIndexType()) + : MetaDataUtil.getLegacyViewIndexIdDataType(); IndexType indexType = IndexType.getDefault(); if(table.hasIndexType()){ indexType = IndexType.fromSerializedValue(table.getIndexType().toByteArray()[0]); @@ -1350,7 +1363,7 @@ public static PTable createFromProto(PTableProtos.PTable table) { result.init(tenantId, schemaName, tableName, tableType, indexState, timeStamp, sequenceNumber, pkName, (bucketNum == NO_SALTING) ? null : bucketNum, columns, parentSchemaName, parentTableName, indexes, isImmutableRows, physicalNames, defaultFamilyName, viewStatement, disableWAL, - multiTenant, storeNulls, viewType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, + multiTenant, storeNulls, viewType, viewIndexType, viewIndexId, indexType, baseColumnCount, rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, indexDisableTimestamp, isNamespaceMapped, autoParititonSeqName, isAppendOnlySchema, storageScheme, qualifierEncodingScheme, encodedColumnQualifierCounter, useStatsForParallelization); return result; @@ -1373,7 +1386,8 @@ public static PTableProtos.PTable toProto(PTable table) { } if(table.getViewIndexId() != null) { builder.setViewIndexId(table.getViewIndexId()); - } + builder.setViewIndexType(table.getViewIndexType().getSqlType()); + } if(table.getIndexType() != null) { builder.setIndexType(ByteStringer.wrap(new byte[]{table.getIndexType().getSerializedValue()})); } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java index 596c3eb2d28..39c3976c3b3 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.sql.SQLException; +import java.sql.Types; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -573,6 +574,10 @@ public static SequenceKey getViewIndexSequenceKey(String tenantId, PName physica } public static PDataType getViewIndexIdDataType() { + return PLong.INSTANCE; + } + + public static PDataType getLegacyViewIndexIdDataType() { return PSmallint.INSTANCE; } diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/TenantSpecificViewIndexCompileTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/TenantSpecificViewIndexCompileTest.java index 3ab6a1990c5..7b54cf1cc8a 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/TenantSpecificViewIndexCompileTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/TenantSpecificViewIndexCompileTest.java @@ -50,7 +50,7 @@ public void testOrderByOptimizedOut() throws Exception { conn.createStatement().execute("CREATE INDEX i1 ON v(v2) INCLUDE(v1)"); ResultSet rs = conn.createStatement().executeQuery("EXPLAIN SELECT v1,v2 FROM v WHERE v2 > 'a' ORDER BY v2"); - assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-32768,'me','a'] - [-32768,'me',*]", + assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-9223372036854775808,'me','a'] - [-9223372036854775808,'me',*]", QueryUtil.getExplainPlan(rs)); } @@ -194,7 +194,7 @@ public void testViewConstantsOptimizedOut() throws Exception { conn.createStatement().execute("CREATE INDEX i1 ON v(v2)"); ResultSet rs = conn.createStatement().executeQuery("EXPLAIN SELECT v2 FROM v WHERE v2 > 'a' and k2 = 'a' ORDER BY v2,k2"); - assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-32768,'me','a'] - [-32768,'me',*]\n" + + assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-9223372036854775808,'me','a'] - [-9223372036854775808,'me',*]\n" + " SERVER FILTER BY FIRST KEY ONLY", QueryUtil.getExplainPlan(rs)); @@ -227,7 +227,7 @@ public void testViewConstantsOptimizedOutOnReadOnlyView() throws Exception { // Confirm that a read-only view on an updatable view still optimizes out the read-only parts of the updatable view ResultSet rs = conn.createStatement().executeQuery("EXPLAIN SELECT v2 FROM v2 WHERE v3 > 'a' and k2 = 'a' ORDER BY v3,k2"); - assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-32768,'me','a'] - [-32768,'me',*]", + assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER _IDX_T [-9223372036854775808,'me','a'] - [-9223372036854775808,'me',*]", QueryUtil.getExplainPlan(rs)); } diff --git a/phoenix-core/src/test/java/org/apache/phoenix/execute/CorrelatePlanTest.java b/phoenix-core/src/test/java/org/apache/phoenix/execute/CorrelatePlanTest.java index 2e881b8392b..26caa0de00b 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/execute/CorrelatePlanTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/execute/CorrelatePlanTest.java @@ -261,7 +261,7 @@ private TableRef createProjectedTableFromLiterals(Object[] row) { PTable pTable = PTableImpl.makePTable(null, PName.EMPTY_NAME, PName.EMPTY_NAME, PTableType.SUBQUERY, null, MetaDataProtocol.MIN_TABLE_TIMESTAMP, PTable.INITIAL_SEQ_NUM, null, null, columns, null, null, Collections.emptyList(), - false, Collections.emptyList(), null, null, false, false, false, null, + false, Collections.emptyList(), null, null, false, false, false, null, null, null, null, true, null, 0, 0L, Boolean.FALSE, null, false, ImmutableStorageScheme.ONE_CELL_PER_COLUMN, QualifierEncodingScheme.NON_ENCODED_QUALIFIERS, EncodedCQCounter.NULL_COUNTER, true); TableRef sourceTable = new TableRef(pTable); List sourceColumnRefs = Lists. newArrayList(); diff --git a/phoenix-core/src/test/java/org/apache/phoenix/execute/LiteralResultIteratorPlanTest.java b/phoenix-core/src/test/java/org/apache/phoenix/execute/LiteralResultIteratorPlanTest.java index 6bf298ef4b8..f400d0bed24 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/execute/LiteralResultIteratorPlanTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/execute/LiteralResultIteratorPlanTest.java @@ -184,7 +184,7 @@ private TableRef createProjectedTableFromLiterals(Object[] row) { PTable pTable = PTableImpl.makePTable(null, PName.EMPTY_NAME, PName.EMPTY_NAME, PTableType.SUBQUERY, null, MetaDataProtocol.MIN_TABLE_TIMESTAMP, PTable.INITIAL_SEQ_NUM, null, null, columns, null, null, Collections. emptyList(), false, Collections. emptyList(), null, null, false, false, - false, null, null, null, true, null, 0, 0L, false, null, false, ImmutableStorageScheme.ONE_CELL_PER_COLUMN, QualifierEncodingScheme.NON_ENCODED_QUALIFIERS, EncodedCQCounter.NULL_COUNTER, true); + false, null, null, null, null, true, null, 0, 0L, false, null, false, ImmutableStorageScheme.ONE_CELL_PER_COLUMN, QualifierEncodingScheme.NON_ENCODED_QUALIFIERS, EncodedCQCounter.NULL_COUNTER, true); TableRef sourceTable = new TableRef(pTable); List sourceColumnRefs = Lists. newArrayList(); for (PColumn column : sourceTable.getTable().getColumns()) { diff --git a/phoenix-protocol/src/main/MetaDataService.proto b/phoenix-protocol/src/main/MetaDataService.proto index 13d8f1aa8ba..f10aa3ccbfe 100644 --- a/phoenix-protocol/src/main/MetaDataService.proto +++ b/phoenix-protocol/src/main/MetaDataService.proto @@ -60,7 +60,8 @@ message SharedTableState { required bytes tableName = 3; repeated PColumn columns = 4; repeated bytes physicalNames = 5; - required int32 viewIndexId = 6; + required int64 viewIndexId = 6; + optional int32 viewIndexType = 7 [default = 5]; } message MetaDataResponse { @@ -75,7 +76,8 @@ message MetaDataResponse { repeated SharedTableState sharedTablesToDelete = 9; optional PSchema schema = 10; optional int64 autoPartitionNum = 11; - optional int32 viewIndexId = 12; + optional int64 viewIndexId = 12; + optional int32 viewIndexType = 13 [default = 5]; } message GetTableRequest { diff --git a/phoenix-protocol/src/main/PTable.proto b/phoenix-protocol/src/main/PTable.proto index bc868bcee68..be771a9c86d 100644 --- a/phoenix-protocol/src/main/PTable.proto +++ b/phoenix-protocol/src/main/PTable.proto @@ -85,7 +85,7 @@ message PTable { optional bytes viewStatement = 18; repeated bytes physicalNames = 19; optional bytes tenantId = 20; - optional int32 viewIndexId = 21; + optional int64 viewIndexId = 21; optional bytes indexType = 22; optional int64 statsTimeStamp = 23; optional bool storeNulls = 24; @@ -103,6 +103,7 @@ message PTable { repeated EncodedCQCounter encodedCQCounters = 36; optional bool useStatsForParallelization = 37; optional int32 transactionProvider = 38; + optional int32 viewIndexType = 39 [default = 5]; } message EncodedCQCounter { diff --git a/phoenix-protocol/src/main/ServerCachingService.proto b/phoenix-protocol/src/main/ServerCachingService.proto index c059a1a4b51..d92f2cdab57 100644 --- a/phoenix-protocol/src/main/ServerCachingService.proto +++ b/phoenix-protocol/src/main/ServerCachingService.proto @@ -62,6 +62,7 @@ message IndexMaintainer { repeated ColumnInfo indexedColumnInfo = 19; required int32 encodingScheme = 20; required int32 immutableStorageScheme = 21; + optional int32 viewIndexType = 22 ; } message AddServerCacheRequest {