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


##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -277,61 +268,291 @@ private Predicate 
transformKeyPrefixesToPredicate(List<String> keyPrefixes) {
     return Predicates.startsWithAny(null, right);
   }
 
-  @Override
-  protected Map<String, HoodieRecord<HoodieMetadataPayload>> 
getRecordsByKeys(List<String> keys, String partitionName) {
-    if (keys.isEmpty()) {
-      return Collections.emptyMap();
+  private HoodiePairData<String, HoodieRecord<HoodieMetadataPayload>> 
doLookupWithMapping(
+          HoodieData<String> keys, String partitionName, List<FileSlice> 
fileSlices, boolean isSecondaryIndex,
+          Option<SerializableFunction<String, String>> keyEncodingFn) {
+
+    final int numFileSlices = fileSlices.size();
+    if (numFileSlices == 1) {
+      TreeSet<String> distinctSortedKeys = new TreeSet<>(keys.collectAsList());
+      return lookupRecordsWithMapping(partitionName, new 
ArrayList<>(distinctSortedKeys), fileSlices.get(0), !isSecondaryIndex, 
keyEncodingFn);
     }
 
-    Map<String, HoodieRecord<HoodieMetadataPayload>> result;
+    SerializableBiFunction<String, Integer, Integer> mappingFunction = 
HoodieTableMetadataUtil::mapRecordKeyToFileGroupIndex;

Review Comment:
   > Then for SI v2, we have 2 cases requires different implementation:
   
   Got your point, I simplify the code a little bit and remove redundant logic, 
also add some docs on it.



-- 
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]

Reply via email to