Davis-Zhang-Onehouse commented on code in PR #13489:
URL: https://github.com/apache/hudi/pull/13489#discussion_r2174076516


##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1360,15 +1362,33 @@ private static List<Tuple3<String, String, Boolean>> 
fetchPartitionFileInfoTripl
   }
 
   /**
-   * Map a record key to a file group in partition of interest.
+   * Maps a record key to a file group index in the specified partition.
    * <p>
-   * Note: For hashing, the algorithm is same as String.hashCode() but is 
being defined here as hashCode()
-   * implementation is not guaranteed by the JVM to be consistent across JVM 
versions and implementations.
+   * For secondary index partitions (version >= 2), if the record key contains 
the secondary index separator,
+   * the secondary key portion is used for hashing. Otherwise, the full record 
key is used.
+   * <p>
+   * Note: The hashing algorithm is same as String.hashCode() but is defined 
here explicitly since
+   * hashCode() implementation is not guaranteed by the JVM to be consistent 
across versions.
    *
-   * @param recordKey record key for which the file group index is looked up 
for.
-   * @return An integer hash of the given string
+   * @param recordKey record key for which the file group index is looked up
+   * @param numFileGroups number of file groups to map the key to
+   * @param partitionName name of the partition
+   * @param version index version to determine hashing behavior
+   * @return file group index for the given record key
    */
-  public static int mapRecordKeyToFileGroupIndex(String recordKey, int 
numFileGroups) {
+  public static int mapRecordKeyToFileGroupIndex(
+      String recordKey, int numFileGroups, String partitionName, 
HoodieIndexVersion version) {
+    if 
(MetadataPartitionType.SECONDARY_INDEX.matchesPartitionPath(partitionName)

Review Comment:
   Done in commit with title "split into get func and hash func - index lookup 
implementation 2"



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