All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.catboost.spark.impl.ExpressionEncoderSerializer.scala Maven / Gradle / Ivy

The newest version!
package ai.catboost.spark.impl

import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.encoders.{ExpressionEncoder,RowEncoder}
import org.apache.spark.sql.types.StructType


object ExpressionEncoderSerializer {
  def apply(schema: StructType) : ExpressionEncoderSerializer = {
    new ExpressionEncoderSerializer(RowEncoder(schema).createSerializer())
  }
}


class ExpressionEncoderSerializer(val serializer: ExpressionEncoder.Serializer[Row]) {
  def toInternalRow(row : Row) : InternalRow = {
    serializer(row)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy