Skip to content

Conversation

@ashvina
Copy link
Contributor

@ashvina ashvina commented Mar 6, 2025

Fixes #658

This change fixes a test only. The test is currently comparing the equality of two lists, which would fail if the order of elements in the lists differ. Since the test is order insensitive, the right solution is to convert the lists to sets. Set equality is order independent.

@ashvina ashvina linked an issue Mar 6, 2025 that may be closed by this pull request
4 tasks
Comment on lines +139 to 140
assertEqualsIgnoreOrder(
expectedPartitionToReplacedFileIds, replaceMetadata.getPartitionToReplacedFileIds());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to ?
assertEquals(new HashSet<>(expectedPartitionToReplacedFileIds), new HashSet<>(replaceMetadata.getPartitionToReplacedFileIds()))

Copy link
Contributor Author

@ashvina ashvina Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vinishjail97 . I didn't understand. Have you tried this change, does it compile?

  1. expectedPartitionToReplacedFileIds is a HashMap which cannnot be used to initialize a HashSet
  2. The order mismatch happens in the values of the HashMaps, where the values are Lists. The tests fails when the values in the lists are out of order. Please see the example in the bug report for reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you please confirm that Hudi does not depend on the order of the files in the lists?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad didn't see it was Map<String, List<String>>, change LGTM.

Hudi does not depend on the order of the files in the lists?
Yes it does not depend on order.

@ashvina ashvina merged commit fc1ba78 into main Mar 6, 2025
2 checks passed
@ashvina ashvina deleted the 658-testbasefileupdatesextractor-convertdiff-is-flaky branch March 6, 2025 23:18
@vinishjail97 vinishjail97 mentioned this pull request Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestBaseFileUpdatesExtractor.convertDiff is flaky

2 participants