Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/20757#discussion_r173132924 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala --- @@ -1416,13 +1417,42 @@ case class ValidateExternalType(child: Expression, expected: DataType) override def nullable: Boolean = child.nullable - override def dataType: DataType = RowEncoder.externalDataTypeForInput(expected) - - override def eval(input: InternalRow): Any = - throw new UnsupportedOperationException("Only code-generated evaluation is supported") + override val dataType: DataType = RowEncoder.externalDataTypeForInput(expected) private val errMsg = s" is not a valid external type for schema of ${expected.simpleString}" + private lazy val dataTypeClazz = if (dataType.isInstanceOf[ObjectType]) { + dataType.asInstanceOf[ObjectType].cls + } else { + // Some external types (e.g., native types and `PythonUserDefinedType`) might not be ObjectType + ScalaReflection.classForNativeTypeOf(dataType) + } + + private lazy val checkType = expected match { --- End diff -- Just for readability add the type here.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org