ai.catboost.spark.impl.ExpressionEncoderSerializer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catboost-spark_3.5_2.13 Show documentation
Show all versions of catboost-spark_3.5_2.13 Show documentation
JVM module to use CatBoost on Apache Spark
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
import org.apache.spark.sql.types.StructType
object ExpressionEncoderSerializer {
def apply(schema: StructType) : ExpressionEncoderSerializer = {
new ExpressionEncoderSerializer(ExpressionEncoder(schema).createSerializer())
}
}
class ExpressionEncoderSerializer(val serializer: ExpressionEncoder.Serializer[Row]) {
def toInternalRow(row : Row) : InternalRow = {
serializer(row)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy