[VL] Remove invalid code path for shuffle read#12403
Closed
marin-ma wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the Velox backend shuffle read/deserialization flow by removing the fallback (row-based) deserialization path and tightening expectations so that the shuffle reader uses Gluten’s columnar serializer/reader path only.
Changes:
- Simplified
ColumnarShuffleReader(and the Delta optimized-writer shuffle reader) to always useColumnarBatchSerializerInstance.deserializeStreams(...)for batch deserialization. - Removed the now-unused
deserializeStream(...)implementation from the VeloxColumnarBatchSerializerinstance implementation. - Centralized “unsupported”
SerializerInstanceAPIs inColumnarBatchSerializerInstance(now throwingUnsupportedOperationException).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backends-velox/src/main/scala/org/apache/spark/shuffle/ColumnarShuffleReader.scala | Removes non-columnar dependency fallback and always deserializes via deserializeStreams. |
| backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializerInstance.scala | Marks generic SerializerInstance APIs as unsupported for this columnar shuffle serializer instance. |
| backends-velox/src/main/scala/org/apache/gluten/vectorized/ColumnarBatchSerializer.scala | Removes the unused single-stream deserialization and redundant unsupported overrides from the concrete serializer instance. |
| backends-velox/src-delta33/main/scala/org/apache/spark/sql/delta/perf/GlutenDeltaOptimizedWriterExec.scala | Aligns Delta optimized writer shuffle reader with the columnar-only deserialization path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+32
to
35
| // These methods are never called by shuffle code. | ||
| override def serialize[T: ClassTag](t: T): ByteBuffer = { | ||
| throw new UnsupportedOperationException | ||
| } |
Comment on lines
+91
to
+95
| fetchContinuousBlocksInBatch | ||
| ).toCompletionIterator | ||
|
|
||
| val recordIter = dep match { | ||
| case columnarDep: ColumnarShuffleDependency[K, _, C] => | ||
| // If the dependency is a ColumnarShuffleDependency, we use the columnar serializer. | ||
| columnarDep.serializer | ||
| .newInstance() | ||
| .asInstanceOf[ColumnarBatchSerializerInstance] | ||
| .deserializeStreams(wrappedStreams) | ||
| .asKeyValueIterator | ||
| case _ => | ||
| val serializerInstance = dep.serializer.newInstance() | ||
| // Create a key/value iterator for each stream | ||
| wrappedStreams.flatMap { | ||
| case (blockId, wrappedStream) => | ||
| // Note: the asKeyValueIterator below wraps a key/value iterator inside of a | ||
| // NextIterator. The NextIterator makes sure that close() is called on the | ||
| // underlying InputStream when all records have been read. | ||
| serializerInstance.deserializeStream(wrappedStream).asKeyValueIterator | ||
| } | ||
| val columnarDep = dep match { | ||
| case d: ColumnarShuffleDependency[_, _, _] => |
Comment on lines
+337
to
+341
| @@ -338,25 +338,18 @@ private class GlutenOptimizedWriterShuffleReader( | |||
| ).toCompletionIterator | |||
|
|
|||
| // Create a key/value iterator for each stream | |||
| val recordIter = dep match { | |||
| case columnarDep: ColumnarShuffleDependency[Int, ColumnarBatch, ColumnarBatch] => | |||
| // If the dependency is a ColumnarShuffleDependency, we use the columnar serializer. | |||
| columnarDep.serializer | |||
| .newInstance() | |||
| .asInstanceOf[ColumnarBatchSerializerInstance] | |||
| .deserializeStreams(wrappedStreams) | |||
| .asKeyValueIterator | |||
| case _ => | |||
| val serializerInstance = dep.serializer.newInstance() | |||
| // Create a key/value iterator for each stream | |||
| wrappedStreams.flatMap { | |||
| case (blockId, wrappedStream) => | |||
| // Note: the asKeyValueIterator below wraps a key/value iterator inside of a | |||
| // NextIterator. The NextIterator makes sure that close() is called on the | |||
| // underlying InputStream when all records have been read. | |||
| serializerInstance.deserializeStream(wrappedStream).asKeyValueIterator | |||
| } | |||
| val columnarDep = dep match { | |||
f5676f6 to
f17d014
Compare
Contributor
Author
|
Closing this as |
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.
Refine code paths for shuffle reader and deserialiser:
ColumnarShuffleDependency. Other type of dependencies are invalid.deserializeStreamis not used.