Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file batch operation #5519

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Fix file batch operation #5519

merged 1 commit into from
Oct 25, 2024

Conversation

RustedBones
Copy link
Contributor

RemoteFileUtil did not preserve element ordering wich was assumed in the FileDownloadDoFn

Pane information was not propagated

Comment on lines -129 to -131
Iterator<OutputT> i1 = outputs.iterator();
Iterator<Element> i2 = batch.iterator();
while (i1.hasNext() && i2.hasNext()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This parts assumes that List<Output> is 1:1 mapping of List<URI>

@@ -104,7 +106,12 @@ public Path download(URI src) {
*/
public List<Path> download(List<URI> srcs) {
try {
return paths.getAll(srcs).values().asList();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

getAll(srcs) returns a Map<URI, Path>. Using values give no guarantee that returned Paths are ordered.

if (batch.isEmpty()) {
return;
}
LOG.info("Processing batch of {}", batch.size());
List<URI> uris = batch.stream().map(e -> e.uri).collect(Collectors.toList());
remoteFileUtil.download(uris).stream().map(fn::apply).forEach(outputReceiver::output);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

original element metadata are not passed back

val paths = p.map { case ((_, f), _) => f }.distinct

val expected = (1L to 100L).map(i => (i.toString, i))
contentAndTimestamp should containInAnyOrder(expected)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran on the original code, got non expected item (1, 10) -> (1st element was flushed while processing the 10th)

RemoteFileUtil did not preserve element ordering wich was assumed in the
FileDownloadDoFn

Pane information was not propagated
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.42%. Comparing base (0a450e9) to head (fac16a0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5519      +/-   ##
==========================================
- Coverage   61.43%   61.42%   -0.01%     
==========================================
  Files         312      312              
  Lines       11103    11103              
  Branches      762      762              
==========================================
- Hits         6821     6820       -1     
- Misses       4282     4283       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@kellen kellen left a comment

Choose a reason for hiding this comment

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

Nice catch!

@RustedBones RustedBones merged commit 489bd7a into main Oct 25, 2024
12 checks passed
@RustedBones RustedBones deleted the fix-file-download-batch branch October 25, 2024 07:07
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.

2 participants