-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-40622][SQL][CORE]Remove the limitation that single task result must fit in 2GB #38064
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
Closed
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
5690fed
replace byte array with ChunkedByteBuffer in single task result colle…
liuzqt 91695ef
Merge branch 'master' into SPARK-40622
liuzqt f9151a4
Update core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer…
liuzqt f486dd8
minor refine
liuzqt ec9c738
extract zero-copy writing in ChunkedByteBuffer as common util function
liuzqt fbbe788
use ByteBuffer for serializedResult
liuzqt babc68b
refine
liuzqt e557605
remove writeToStream
liuzqt e37f684
use getChunks
liuzqt 985ccf8
refine
liuzqt 5ddd527
always deserialize chunks into on-heap buffer
liuzqt 364eae0
try to estimate chunk size in serialization
liuzqt 5c64664
refine
liuzqt 71dd6aa
update estimateBufferChunkSize
liuzqt b82a6ba
nit
liuzqt 8153b77
try to estimate a reasonable upper bound of DirectTaskResult serializ…
liuzqt 890ca25
fix test
liuzqt 40ffef1
refactor: use Utils.writeByteBuffer
liuzqt f34755f
set initial value to ThreadLocal
liuzqt a22cae8
Merge branch 'master' into SPARK-40622
liuzqt 2e68228
Merge remote-tracking branch 'upstream/master' into SPARK-40622
liuzqt cff1231
fix chinese double quote
liuzqt f2f47f8
try to remove scaladoc brackets introduced in this PR
liuzqt b2d4337
add org/apache/spark/util/io to Unidoc.ignoreUndocumentedPackages
liuzqt 30f1805
fix KryoSerializerResizableOutputSuite
liuzqt 5323c94
change LargeResult size to ~2.1GB
liuzqt b2b933b
remove large result test
liuzqt 0853b95
Revert "remove large result test"
liuzqt 20e2bcc
increase jvm mem to 6G in SparkBuild
liuzqt ae9c12b
set jvm mem to 5GB
liuzqt 17d7ac7
skip DatasetLargeResultCollectingSuite in Github Action
liuzqt 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
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
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
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
54 changes: 54 additions & 0 deletions
54
core/src/main/scala/org/apache/spark/serializer/SerializerHelper.scala
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.serializer | ||
|
|
||
| import java.nio.ByteBuffer | ||
|
|
||
| import scala.reflect.ClassTag | ||
|
|
||
| import org.apache.spark.internal.Logging | ||
| import org.apache.spark.util.io.{ChunkedByteBuffer, ChunkedByteBufferOutputStream} | ||
|
|
||
| private[spark] object SerializerHelper extends Logging { | ||
|
|
||
| /** | ||
| * | ||
| * @param serializerInstance instance of SerializerInstance | ||
| * @param objectToSerialize the object to serialize, of type `T` | ||
| * @param estimatedSize estimated size of `t`, used as a hint to choose proper chunk size | ||
liuzqt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| def serializeToChunkedBuffer[T: ClassTag]( | ||
| serializerInstance: SerializerInstance, | ||
| objectToSerialize: T, | ||
| estimatedSize: Long = -1): ChunkedByteBuffer = { | ||
| val chunkSize = ChunkedByteBuffer.estimateBufferChunkSize(estimatedSize) | ||
| val cbbos = new ChunkedByteBufferOutputStream(chunkSize, ByteBuffer.allocate) | ||
| val out = serializerInstance.serializeStream(cbbos) | ||
| out.writeObject(objectToSerialize) | ||
| out.close() | ||
| cbbos.close() | ||
| cbbos.toChunkedByteBuffer | ||
| } | ||
liuzqt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def deserializeFromChunkedBuffer[T: ClassTag]( | ||
| serializerInstance: SerializerInstance, | ||
| bytes: ChunkedByteBuffer): T = { | ||
| val in = serializerInstance.deserializeStream(bytes.toInputStream()) | ||
| in.readObject() | ||
| } | ||
| } | ||
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
Oops, something went wrong.
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 was thinking if this is specific to the chunked byte buffer, would it be beneficial to add this to ChunkedByteBuffer as a static method, e.g.
ChunkedByteBuffer.serialize(...)? Just a question to see if there is a utility in the separate class.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.
Ideally, the
SerializerInstanceshould support ByteBuffer/Stream/ChunkedByteBuffer, but that would add new method to theSerializerInstancebase class. To avoid that, I put this in a helper class (another option is to put it inSerializerInstance's companion object). But I think this method should belong to serializer-related class...we can leave it here or move toSerializerInstance's companion object