You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/09/16 06:32:26 UTC
[GitHub] [hudi] voonhous commented on a diff in pull request #6669: [HUDI-4841] Fix BlockLocation array sorting idempotency issue
voonhous commented on code in PR #6669:
URL: https://github.com/apache/hudi/pull/6669#discussion_r972658947
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/cow/CopyOnWriteInputFormat.java:
##########
@@ -214,13 +213,7 @@ public FileInputSplit[] createInputSplits(int minNumSplits) throws IOException {
// get the block locations and make sure they are in order with respect to their offset
final BlockLocation[] blocks = fs.getFileBlockLocations(file, 0, len);
- Arrays.sort(blocks, new Comparator<BlockLocation>() {
- @Override
- public int compare(BlockLocation o1, BlockLocation o2) {
- long diff = o1.getLength() - o2.getOffset();
- return Long.compare(diff, 0L);
- }
- });
+ Arrays.sort(blocks, CopyOnWriteInputFormat::compareBlockLocations);
Review Comment:
Yes, should work fine here.
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org