[GitHub] [hudi] danny0405 commented on a diff in pull request #9114: [HUDI-6467] Fix deletes handling in rli when partition path is updated

2023-07-03 Thread via GitHub


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


##
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##
@@ -1159,10 +1161,27 @@ protected boolean 
validateTimelineBeforeSchedulingCompaction(Option inFl
* @param writeStatuses {@code WriteStatus} from the write operation
*/
   private HoodieData 
getRecordIndexUpdates(HoodieData writeStatuses) {
-return writeStatuses.flatMap(writeStatus -> {
-  List recordList = new LinkedList<>();
-  for (HoodieRecordDelegate recordDelegate : 
writeStatus.getWrittenRecordDelegates()) {
-if (!writeStatus.isErrored(recordDelegate.getHoodieKey())) {
+// 1. List
+// 2. Reduce by key: accept keys only when new location is not
+return writeStatuses.map(writeStatus -> 
writeStatus.getWrittenRecordDelegates().stream()
+.map(recordDelegate -> Pair.of(recordDelegate.getRecordKey(), 
recordDelegate)))
+.flatMapToPair(Stream::iterator)
+.reduceByKey((recordDelegate1, recordDelegate2) -> {

Review Comment:
   Yeah, wondering whether we have better algorithm to tackle the deduplication 
~



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



[GitHub] [hudi] danny0405 commented on a diff in pull request #9114: [HUDI-6467] Fix deletes handling in rli when partition path is updated

2023-07-03 Thread via GitHub


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


##
hudi-spark-datasource/hudi-spark/src/test/java/org/apache/hudi/functional/TestGlobalIndexEnableUpdatePartitions.java:
##
@@ -65,8 +65,8 @@ private static Stream getTableTypeAndIndexType() {
 Arguments.of(COPY_ON_WRITE, GLOBAL_BLOOM),
 Arguments.of(COPY_ON_WRITE, RECORD_INDEX),
 Arguments.of(MERGE_ON_READ, GLOBAL_SIMPLE),
-Arguments.of(MERGE_ON_READ, GLOBAL_BLOOM),
-Arguments.of(MERGE_ON_READ, RECORD_INDEX)
+Arguments.of(MERGE_ON_READ, GLOBAL_BLOOM)
+// Arguments.of(MERGE_ON_READ, RECORD_INDEX)

Review Comment:
   It passes previously.



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