codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610368740
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition
getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions =
dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName ->
indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions =
dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>>
initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieFunctionalIndexDefinition indexDefinition =
getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index
definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs =
getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFileSlicePairs.size(),
dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
+ HoodieData<HoodieRecord> records = readSecondaryKeysFromFileSlices(
+ engineContext,
+ partitionFileSlicePairs,
+ parallelism,
+ this.getClass().getSimpleName(),
+ dataMetaClient,
+ EngineType.SPARK,
Review Comment:
makes sense.. have added abstract methods which is implemented by
engine-specific metadata writer.
--
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]