-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ORC-998: Sharing compression output buffer among treeWriter: Refactor…
…ing within OutStream for portability ### What changes were proposed in this pull request? There's individual instance of OutStream within each TreeWriter created by WriterContext#createStream method. Within OutStream, there are totally 3 buffers: current: the regular input buffer holding uncompressed, unencrypted bytes. compress: the output buffer holding compressed bytes overflow: same as "compress" but only used when the last compression output is larger than remaining capacity of compress buffer. Potentially the compress and overflow buffer don't have to be allocated individually within each OutStream object, but shared across all of them so to save memory allocation. This PR is the first step for sharing the compression output buffer, which refactors internal of OutStream and make the relevant object bundled together since they are logically related(and details of dealing with overflow doesn't have to be visible). This refactoring makes it easier to share the compression output buffer as a pass-in arguments in the follow-up PR. ### Why are the changes needed? For the context of [ORC-997](https://issues.apache.org/jira/browse/ORC-997), this change makes the compression output buffer, as a single entity, easier to be shared and passed in from caller. ### How was this patch tested? There's no functional changes from this PR so passing all existed unit tests. Also added a new test in TestOutStream to make sure that, the scenario where codec.compress() returns false (meaning the compression output is larger than original input) is also covered in the unit test. This closes #909 Closes #1633 from mystic-lama/autumnust-refactor_compress_buffer. Lead-authored-by: mystic-lama <mysticlama000@gmail.com> Co-authored-by: Lei Sun <autumnust@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
- Loading branch information
1 parent
8a1cb35
commit 22a06b4
Showing
2 changed files
with
192 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters