Skip to content

Commit

Permalink
fix implicit types
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyong-lee-dev committed Apr 29, 2024
1 parent 323098d commit 9d8c3fd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ class Dataset[T] private[sql](
* @since 1.6.0
*/
def select[U1](c1: TypedColumn[T, U1]): Dataset[U1] = {
implicit val encoder: ExpressionEncoder[T] = c1.encoder
implicit val encoder: ExpressionEncoder[U1] = c1.encoder
val project = Project(c1.withInputType(exprEnc, logicalPlan.output).named :: Nil, logicalPlan)

if (!encoder.isSerializedAsStructForTopLevel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets._

import scala.io.{Source => IOSource}

import org.json4s.NoTypeHints
import org.json4s.{Formats, NoTypeHints}
import org.json4s.jackson.Serialization

import org.apache.spark.sql.SparkSession
Expand Down Expand Up @@ -82,7 +82,7 @@ case class CommitMetadata(nextBatchWatermarkMs: Long = 0) {
}

object CommitMetadata {
implicit val format = Serialization.formats(NoTypeHints)
implicit val format: Formats = Serialization.formats(NoTypeHints)

def apply(json: String): CommitMetadata = Serialization.read[CommitMetadata](json)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql.execution.streaming

import scala.util.control.Exception._

import org.json4s.NoTypeHints
import org.json4s.{Formats, NoTypeHints}
import org.json4s.jackson.Serialization

/**
Expand All @@ -34,7 +34,7 @@ case class FileStreamSourceOffset(logOffset: Long) extends Offset {
}

object FileStreamSourceOffset {
implicit val format = Serialization.formats(NoTypeHints)
implicit val format: Formats = Serialization.formats(NoTypeHints)

def apply(offset: Offset): FileStreamSourceOffset = {
offset match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class HDFSMetadataLog[T <: AnyRef : ClassTag](sparkSession: SparkSession, path:
private implicit val formats: Formats = Serialization.formats(NoTypeHints)

/** Needed to serialize type T into JSON when using Jackson */
@scala.annotation.nowarn
private implicit val manifest = Manifest.classType[T](implicitly[ClassTag[T]].runtimeClass)

// Avoid serializing generic sequences, see SPARK-17372
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.spark.sql.execution.streaming

import org.json4s.NoTypeHints
import org.json4s.{Formats, NoTypeHints}
import org.json4s.jackson.Serialization

import org.apache.spark.internal.Logging
Expand Down Expand Up @@ -88,7 +88,7 @@ case class OffsetSeqMetadata(
}

object OffsetSeqMetadata extends Logging {
private implicit val format = Serialization.formats(NoTypeHints)
private implicit val format: Formats = Serialization.formats(NoTypeHints)
/**
* These configs are related to streaming query execution and should not be changed across
* batches of a streaming query. The values of these configs are persisted into the offset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import scala.util.control.NonFatal
import org.apache.commons.io.IOUtils
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileAlreadyExistsException, FSDataInputStream, Path}
import org.json4s.NoTypeHints
import org.json4s.{Formats, NoTypeHints}
import org.json4s.jackson.Serialization

import org.apache.spark.internal.Logging
Expand All @@ -45,7 +45,7 @@ case class StreamMetadata(id: String) {
}

object StreamMetadata extends Logging {
implicit val format = Serialization.formats(NoTypeHints)
implicit val format: Formats = Serialization.formats(NoTypeHints)

/** Read the metadata from file if it exists */
def read(metadataFile: Path, hadoopConf: Configuration): Option[StreamMetadata] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.fasterxml.jackson.module.scala.{ClassTagExtensions, DefaultScalaModul
import org.apache.commons.io.{FilenameUtils, IOUtils}
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileStatus, Path, PathFilter}
import org.json4s.NoTypeHints
import org.json4s.{Formats, NoTypeHints}
import org.json4s.jackson.Serialization

import org.apache.spark.{SparkConf, SparkEnv}
Expand Down Expand Up @@ -737,7 +737,7 @@ case class RocksDBCheckpointMetadata(
object RocksDBCheckpointMetadata {
val VERSION = 1

implicit val format = Serialization.formats(NoTypeHints)
implicit val format: Formats = Serialization.formats(NoTypeHints)

/** Used to convert between classes and JSON. */
lazy val mapper = {
Expand Down

0 comments on commit 9d8c3fd

Please sign in to comment.