danny0405 commented on code in PR #11162:
URL: https://github.com/apache/hudi/pull/11162#discussion_r1623995661


##########
hudi-common/src/main/java/org/apache/hudi/metadata/BaseTableMetadata.java:
##########
@@ -312,6 +312,33 @@ public Map<String, List<HoodieRecordGlobalLocation>> 
readRecordIndex(List<String
     return recordKeyToLocation;
   }
 
+  /**
+   * Get record-location using secondary-index and record-index
+   * <p>
+   * If the Metadata Table is not enabled, an exception is thrown to 
distinguish this from the absence of the key.
+   *
+   * @param secondaryKeys The list of secondary keys to read
+   */
+  @Override
+  public Map<String, List<HoodieRecordGlobalLocation>> 
readSecondaryIndex(List<String> secondaryKeys) {
+    
ValidationUtils.checkState(dataMetaClient.getTableConfig().isMetadataPartitionAvailable(MetadataPartitionType.RECORD_INDEX),
+        "Record index is not initialized in MDT");
+    ValidationUtils.checkState(
+        
dataMetaClient.getTableConfig().getMetadataPartitions().stream().anyMatch(partitionName
 -> 
partitionName.startsWith(MetadataPartitionType.SECONDARY_INDEX.getPartitionPath())),
+        "Secondary index is not initialized in MDT");
+    // Fetch secondary-index records
+    Map<String, List<HoodieRecord<HoodieMetadataPayload>>> secondaryKeyRecords 
= getSecondaryIndexRecords(secondaryKeys, 
MetadataPartitionType.SECONDARY_INDEX.getPartitionPath());
+    // Now collect the record-keys and fetch the RLI records

Review Comment:
   do you mean secondary index records?



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to