This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 50948e4c47d6 [SPARK-53196][CORE] Use Java `OutputStream.nullOutputStream` instead of `ByteStreams.nullOutputStream` 50948e4c47d6 is described below commit 50948e4c47d6886e0934a50bd773b784051a0638 Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Fri Aug 8 06:36:19 2025 -0700 [SPARK-53196][CORE] Use Java `OutputStream.nullOutputStream` instead of `ByteStreams.nullOutputStream` ### What changes were proposed in this pull request? This PR aims to use Java 11+ `OutputStream.nullOutputStream` instead of `ByteStreams.nullOutputStream`. ### Why are the changes needed? We had better use native JDK APIs when it's available. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51924 from dongjoon-hyun/SPARK-53196. Authored-by: Dongjoon Hyun <dongj...@apache.org> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- .../src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala | 4 +--- scalastyle-config.xml | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala b/core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala index 83f646de8372..3981006c7ffe 100644 --- a/core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala +++ b/core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala @@ -27,8 +27,6 @@ import scala.jdk.CollectionConverters._ import scala.reflect.ClassTag import scala.util.control.NonFatal -import com.google.common.io.ByteStreams - import org.apache.spark.{SparkConf, SparkException, TaskContext} import org.apache.spark.internal.Logging import org.apache.spark.internal.LogKeys._ @@ -905,7 +903,7 @@ private[storage] class PartiallySerializedBlock[T]( // We want to close the output stream in order to free any resources associated with the // serializer itself (such as Kryo's internal buffers). close() might cause data to be // written, so redirect the output stream to discard that data. - redirectableOutputStream.setOutputStream(ByteStreams.nullOutputStream()) + redirectableOutputStream.setOutputStream(OutputStream.nullOutputStream()) serializationStream.close() } finally { discarded = true diff --git a/scalastyle-config.xml b/scalastyle-config.xml index 42e3913f10d6..5dac96a5a7ac 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -752,6 +752,11 @@ This file is divided into 3 sections: <customMessage>Use readFully of JavaUtils/SparkStreamUtils/Utils instead.</customMessage> </check> + <check customId="nullOutputStream" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> + <parameters><parameter name="regex">\bByteStreams\.nullOutputStream\b</parameter></parameters> + <customMessage>Use OutputStream.nullOutputStream instead.</customMessage> + </check> + <check customId="maputils" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> <parameters><parameter name="regex">org\.apache\.commons\.collections4\.MapUtils\b</parameter></parameters> <customMessage>Use org.apache.spark.util.collection.Utils instead.</customMessage> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org