nsivabalan commented on code in PR #13436:
URL: https://github.com/apache/hudi/pull/13436#discussion_r2151418769
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java:
##########
@@ -106,6 +114,31 @@ protected HoodieWriteHandle(HoodieWriteConfig config,
String instantTime, String
this.recordMerger = config.getRecordMerger();
this.writeStatus = (WriteStatus)
ReflectionUtils.loadClass(config.getWriteStatusClassName(),
hoodieTable.shouldTrackSuccessRecords(),
config.getWriteStatusFailureFraction(), hoodieTable.isMetadataTable());
+ this.isStreamingWriteToMetadataEnabled =
config.isMetadataStreamingWritesEnabled(hoodieTable.getMetaClient().getTableConfig().getTableVersion());
+ initMetadataPartitionsToCollectStats();
+ }
+
+ private void initMetadataPartitionsToCollectStats() {
+ if (isStreamingWriteToMetadataEnabled) {
+ // secondary index.
+ if (config.isSecondaryIndexEnabled()) {
+ ValidationUtils.checkArgument(recordMerger.getRecordType() ==
HoodieRecord.HoodieRecordType.AVRO,
+ "Only Avro record type is supported for streaming writes to
metadata table with write handles");
+ secondaryIndexDefns =
hoodieTable.getMetaClient().getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(mdtPartition ->
mdtPartition.startsWith(PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .map(mdtPartitionPath -> Pair.of(mdtPartitionPath,
HoodieTableMetadataUtil.getHoodieIndexDefinition(mdtPartitionPath,
hoodieTable.getMetaClient())))
+ .collect(Collectors.toList());
+ secondaryIndexDefns.forEach(pair ->
writeStatus.getIndexStats().instantiateSecondaryIndexStatsForIndex(pair.getKey()));
+ }
+ }
+ }
+
+ /**
+ * Returns true if streaming is enabled and secondary index is configured
for the table.
Review Comment:
fix java docs
--
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]