Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
d4cd5deb
Commit
d4cd5deb
authored
11 years ago
by
Patrick Wendell
Browse files
Options
Downloads
Patches
Plain Diff
Fix for Kryo Serializer
parent
c3816de5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
+13
-2
13 additions, 2 deletions
.../apache/spark/util/collection/ExternalAppendOnlyMap.scala
with
13 additions
and
2 deletions
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
+
13
−
2
View file @
d4cd5deb
...
...
@@ -26,7 +26,7 @@ import scala.collection.mutable
import
scala.collection.mutable.ArrayBuffer
import
org.apache.spark.
{
Logging
,
SparkEnv
}
import
org.apache.spark.serializer.Serializer
import
org.apache.spark.serializer.
{
KryoDeserializationStream
,
KryoSerializationStream
,
Serializer
}
import
org.apache.spark.storage.
{
BlockId
,
BlockManager
,
DiskBlockManager
,
DiskBlockObjectWriter
}
/**
...
...
@@ -333,7 +333,18 @@ private[spark] class ExternalAppendOnlyMap[K, V, C](
if
(!
eof
)
{
try
{
if
(
objectsRead
==
serializerBatchSize
)
{
deserializeStream
=
ser
.
deserializeStream
(
compressedStream
)
val
newInputStream
=
deserializeStream
match
{
case
stream
:
KryoDeserializationStream
=>
// Kryo's serializer stores an internal buffer that pre-fetches from the underlying
// stream. We need to capture this buffer and feed it to the new serialization
// stream so that the bytes are not lost.
val
kryoInput
=
stream
.
input
val
remainingBytes
=
kryoInput
.
limit
()
-
kryoInput
.
position
()
val
extraBuf
=
kryoInput
.
readBytes
(
remainingBytes
)
new
SequenceInputStream
(
new
ByteArrayInputStream
(
extraBuf
),
compressedStream
)
case
_
=>
compressedStream
}
deserializeStream
=
ser
.
deserializeStream
(
newInputStream
)
objectsRead
=
0
}
objectsRead
+=
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment