Repository navigation
[SPARK-60074][SQL] Avoid parsing the requested schema twice per split in the vectorized Parquet reader - #59287
Open
dwsmith1983 wants to merge 1 commit into
Open
dwsmith1983 wants to merge 1 commit into
dwsmith1983 wants to merge 1 commit into
Conversation
… in the vectorized Parquet reader
Contributor
Author
|
cc @cloud-fan @dongjoon-hyun, could you take a look when you have a moment? |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
SpecificParquetRecordReaderBase.initializecreates aParquetReadSupport, calls itsinit(which parses the requested Spark schema JSON from theSPARK_ROW_REQUESTED_SCHEMAconf value), and then parsed the same JSON again withStructType.fromString. This PR adds a package-private accessor for the schemaParquetReadSupport.initparsed and reuses it. For any other read support class, the reader still parses the conf value as before.Why are the changes needed?
Performance on wide reads. The parse runs once per file split and its cost grows with the number of requested columns: about 0.6 ms per call for 1000 columns.
On 400 Parquet files with 1000 INT columns (local[1], JDK 17, two interleaved before/after pairs, best time):
SELECT *SELECT c0SELECT *is about 4-7% faster.SELECT c0requests one column, so its parse is trivial and it does not change.Does this PR introduce any user-facing change?
No.
How was this patch tested?
New test in
ParquetIOSuitechecking thatVectorizedParquetRecordReaderuses the same schema instance its read support parsed (it fails without this change because the reader parses a second copy).Existing suites pass:
ParquetIOSuite,ParquetV1QuerySuite,ParquetV2QuerySuite,ParquetSchemaSuite,ParquetVectorizedSuite,ParquetColumnIndexSuite,ParquetEncodingSuite,ParquetStorageFilterSuite,ParquetFileFormatV1SuiteandParquetFileFormatV2Suite.The numbers above come from a local benchmark run before and after the change on the same commit.
Was this patch authored or co-authored using generative AI tooling?
No