LuciferYang edited a comment on pull request #33556:
URL: https://github.com/apache/spark/pull/33556#issuecomment-891055156
> Could we just avoid file operations when initialized=false in
revertPartialWritesAndClose?
@Ngone51 Or Could we just avoid file operations when `numRecordsWritten >
0` in `revertPartialWritesAndClose`?
In this way, we can revert the change of `ExternalSorter` and
`ExternalAppendOnlyMap`
like
```
Utils.tryWithSafeFinally {
if (initialized) {
writeMetrics.decBytesWritten(reportedPosition - committedPosition)
writeMetrics.decRecordsWritten(numRecordsWritten)
streamOpen = false
closeResources()
}
} {
// if `reportedPosition > committedPosition`, there will be
uncommitted data.
if (numRecordsWritten > 0) {
// do truncate file operations.
}
}
```
--
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]