yihua commented on code in PR #11634:
URL: https://github.com/apache/hudi/pull/11634#discussion_r1742771361
##########
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java:
##########
@@ -319,6 +331,16 @@ public boolean
isMetadataPartitionAvailable(HoodieTableMetaClient metaClient) {
this.recordType = recordType;
}
+ /**
+ * Get the partition name from the metadata partition type.
+ * NOTE: For certain types of metadata partition, such as functional index
and secondary index,
+ * partition path defined enum is just the prefix to denote the type of
metadata partition.
+ * The actual partition name is contained in the index definition.
+ */
+ public String getPartitionPath(HoodieTableMetaClient metaClient, String
indexName) {
+ return getPartitionPath();
+ }
+
public String getPartitionPath() {
return partitionPath;
}
Review Comment:
We should remove this API now.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java:
##########
@@ -319,6 +331,16 @@ public boolean
isMetadataPartitionAvailable(HoodieTableMetaClient metaClient) {
this.recordType = recordType;
}
+ /**
+ * Get the partition name from the metadata partition type.
+ * NOTE: For certain types of metadata partition, such as functional index
and secondary index,
+ * partition path defined enum is just the prefix to denote the type of
metadata partition.
+ * The actual partition name is contained in the index definition.
+ */
+ public String getPartitionPath(HoodieTableMetaClient metaClient, String
indexName) {
+ return getPartitionPath();
Review Comment:
Return `partitionPath` instead.
##########
hudi-common/src/test/java/org/apache/hudi/metadata/TestMetadataPartitionType.java:
##########
@@ -183,4 +187,40 @@ public void testGetMetadataPartitionRecordType() {
assertEquals(6, MetadataPartitionType.PARTITION_STATS.getRecordType());
assertEquals(7, MetadataPartitionType.SECONDARY_INDEX.getRecordType());
}
+
+ @Test
+ public void testGetFunctionalIndexPath() {
+ MetadataPartitionType partitionType =
MetadataPartitionType.FUNCTIONAL_INDEX;
+ HoodieTableMetaClient metaClient = mock(HoodieTableMetaClient.class);
+ String indexName = "testIndex";
+
+ Map<String, HoodieIndexDefinition> indexDefinitions = new HashMap<>();
+ indexDefinitions.put(
+ indexName,
+ new HoodieIndexDefinition("func_index_testIndex", "column_stats",
"lower", Collections.singletonList("name"), null));
+ HoodieIndexMetadata indexMetadata = new
HoodieIndexMetadata(indexDefinitions);
+ when(metaClient.getIndexMetadata()).thenReturn(Option.of(indexMetadata));
+
+ String result = partitionType.getPartitionPath(metaClient, indexName);
+ assertEquals("func_index_testIndex", result);
+ }
+
+ @Test
+ public void testGetNonFunctionalIndexPath() {
+ MetadataPartitionType partitionType = MetadataPartitionType.COLUMN_STATS;
+ HoodieTableMetaClient metaClient = mock(HoodieTableMetaClient.class);
+
+ String result = partitionType.getPartitionPath(metaClient, null);
+ assertEquals(partitionType.getPartitionPath(), result);
Review Comment:
Cover all partition types?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]