geruh commented on code in PR #2947:
URL: https://github.com/apache/iceberg-python/pull/2947#discussion_r2724966166
##########
pyiceberg/table/update/snapshot.py:
##########
@@ -792,14 +788,7 @@ def merge_bin(manifest_bin: list[ManifestFile]) ->
list[ManifestFile]:
executor = ExecutorFactory.get_or_create()
futures = [executor.submit(merge_bin, b) for b in bins]
-
- # for consistent ordering, we need to maintain future order
- futures_index = {f: i for i, f in enumerate(futures)}
- completed_futures: SortedList[Future[list[ManifestFile]]] =
SortedList(iterable=[], key=lambda f: futures_index[f])
- for future in concurrent.futures.as_completed(futures):
- completed_futures.add(future)
-
- bin_results: list[list[ManifestFile]] = [f.result() for f in
completed_futures if f.result()]
+ bin_results: list[list[ManifestFile]] = [r for f in futures if (r :=
f.result())]
Review Comment:
We can use a walrus operator to avoid calling `.result()` twice per future
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]