-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-30414][SQL] ParquetRowConverter optimizations: arrays, maps, plus misc. constant factors #27089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
JoshRosen
wants to merge
6
commits into
apache:master
from
JoshRosen:joshrosen/more-ParquetRowConverter-optimizations
Closed
[SPARK-30414][SQL] ParquetRowConverter optimizations: arrays, maps, plus misc. constant factors #27089
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
90cebf0
Add private[this] to vals
JoshRosen 7318785
Save a .updater() call for each field
JoshRosen e05de15
Only call currentRow.numFields once per loop
JoshRosen c7d1534
Replace Scala ArrayBuffer with Java ArrayList; clear buffer and re-us…
JoshRosen 4456f91
Avoid GenericArrayData constructor perf. problems (see SPARK-30413)
JoshRosen 6d16f59
Roll back to using Scala ArrayBuffer, but continue using clear()
joshrosen-stripe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends on
currentArray.toArraycopies the elements or not?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayBuffer.toArrayshould always return a fresh unshared array object (internally, it allocates a new array and then callscopyToArray).It doesn't do copying / cloning of the array elements themselves, but that shouldn't be a problem: by design, the objects that are inserted into this array are unshared / immutable: the map and array converters always return unshared objects and we always
.copy()rows when inserting them into a map or array parent container (this is still true after the changes in #26993).I did a bit of archaeology and tracked down the source of the
// NOTEcomment here: it was added in #7231 and at that time it looks like we were actually passing themutable.ArrayBufferitself toupdater: https://github.com/apache/spark/blame/360fe18a61538b03cac05da1c6d258e124df6feb/sql/core/src/main/scala/org/apache/spark/sql/parquet/CatalystRowConverter.scala#L321. The comment makes sense in that context: with that older code, we would wind up withRow()objects that containedmutable.ArrayBuffers.Later, in #7724 this was changed to pass a
new GenericArrayData(currentArray.toArray)to the parent updater: c0cc0ea#diff-1d6c363c04155a9328fe1f5bd08a2f90. At that point I think we could have safely made the change to begin reusing themutable.ArrayBuffersince it no longer escaped its converter.