Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/18091#discussion_r118360110
--- Diff:
core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java ---
@@ -425,14 +425,8 @@ void forceSorterToSpill() throws IOException {
long bytesToTransfer = partitionLengthInSpill;
final FileChannel spillInputChannel = spillInputChannels[i];
final long writeStartTime = System.nanoTime();
- while (bytesToTransfer > 0) {
- final long actualBytesTransferred =
spillInputChannel.transferTo(
- spillInputChannelPositions[i],
- bytesToTransfer,
- mergedFileOutputChannel);
- spillInputChannelPositions[i] += actualBytesTransferred;
- bytesToTransfer -= actualBytesTransferred;
- }
+ Utils.copyFileStreamNIO(spillInputChannel,
mergedFileOutputChannel, bytesToTransfer);
--- End diff --
This is not equivalent to the old code. The `copyFileStreamNIO` method is
assuming that you're starting to transfer from position 0 in the input channel,
which is only true on the first iteration of the outer loop.
I think you need to add a fourth argument to `copyFileStreamNIO` to specify
the starting position of the input channel.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]