Github user mridulm commented on the pull request:
https://github.com/apache/spark/pull/397#issuecomment-40278958
Your summarization is fairly accurate @srowen. To add, my initial approach
was to subclass to minimize code :-)
The reason why I moved away from it was because I did not want to expose
the toByteArray method : to prevent current/future accidental invocation of
that (expensive) method.
Not to mention, a bunch of other methods which actually wont work (more
below) in our context.
Before going into details, please note that the main purpose of this stream
is to actually get a ByteBuffer out of the data which is subsequently used.
And what is not mentioned above is that the actual use of this class is
within another class which multiplexes over these baos instances - so that we
are not limited to 2Gb limit : we have an Sequence of these streams : which
will be read in order to get to the actual data (the wrapper OutputStream moves
from first to next as required; and returns a Seq[ByteBuffer] when we are done
writing to it).
Which is why most of the methods wont work - reset, close, toByteArray,
toString : since the output stream is not starting at a data boundary : but
inside the context of a larger stream. We could leave the methods around : but
it did not look right to leave potentially broken functionality around.
---
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.
---