Spark: Add vectorized Parquet reads for variant columns#16292
Open
nssalian wants to merge 6 commits into
Open
Conversation
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.
Follow up to #16087 - fixing the Vectorized support for variant to remove the temporary patches.
Rationale for this Change
Variant columns currently force the entire table into row-at-a-time reads because the vectorized reader doesn't handle them. This PR fixes that by reading variant's metadata and value children as Arrow VarBinary batches.
What changes are included in this PR?
VectorizedReaderBuilder- addsvariantVisitor()that creates aVectorizedVariantVisitorscoped to each variant column's Parquet pathVectorizedVariantVisitor- walks variant's internal structure, creates Arrow readers for metadata + value leavesVectorizedArrowReader.VectorizedVariantReader- composes two child readers, delegatesread/setRowGroupInfo/setBatchSize/closeVectorHolder.VariantVectorHolder- carries both child holders through the batch pipelineVariantColumnVector(new) - SparkColumnVectorimplementinggetChild(0)= value,getChild(1)= metadata per Spark'sgetVariant()contract
ColumnVectorBuilder- dispatchesVariantVectorHolderbeforeisDummy()checkSparkBatch- allows unshredded variant through the batch-reads gate; tables with write.parquet.shred-variants=true fall back to row-at-a-time automaticallyassumeThat(vectorized).isFalse()guards; all variant read tests now run with vectorization enabledLimitations
Are these changes tested?
TestSparkVariantRead(v4.0 + v4.1) - all tests now run with bothvectorized=falseandvectorized=true. Previously, thetruevalue tests were skipped.TestVariantShredding(v4.0 + v4.1) - table created withPARQUET_SHRED_VARIANTS=trueso the SparkBatch handles the fallbackTestSnapshotTableProcedure(v4.0 + v4.1) - disables vectorization for variant imported from non-Iceberg files (missing VARIANT annotation)Are there any user-facing changes?