Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.apache.spark.sql

import com.sparkutils.shim.ShowParams
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.analysis.{FunctionRegistry, GetColumnByOrdinal, TypeCheckResult, UnresolvedFunction, UnresolvedRelation}
import org.apache.spark.sql.catalyst.encoders.{ExpressionEncoder, RowEncoder}
import org.apache.spark.sql.catalyst.expressions.{Add, Attribute, BoundReference, Cast, CreateNamedStruct, Expression, GetArrayStructFields, GetStructField, If, Literal, NamedExpression, PrettyAttribute, Stateful}
Expand All @@ -27,6 +28,12 @@ object ShimUtils {
unresolvedFunction.copy(children = children)
}

implicit class ExpressionEncoderOps[T](expressionEncoder: ExpressionEncoder[T]) {
def createDeserializer(): InternalRow => T = expressionEncoder.fromRow

def createSerializer(): T => InternalRow = expressionEncoder.toRow
}

def isPrimitive(dataType: DataType) =
dataType match {
case BooleanType => true
Expand Down
Loading