sadhen commented on a change in pull request #32026: URL: https://github.com/apache/spark/pull/32026#discussion_r606035644
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/python/ArrowEvalPythonExec.scala ########## @@ -89,9 +89,57 @@ case class ArrowEvalPythonExec(udfs: Seq[PythonUDF], resultAttrs: Seq[Attribute] columnarBatchIter.flatMap { batch => val actualDataTypes = (0 until batch.numCols()).map(i => batch.column(i).dataType()) - assert(outputTypes == actualDataTypes, "Invalid schema from pandas_udf: " + - s"expected ${outputTypes.mkString(", ")}, got ${actualDataTypes.mkString(", ")}") + assert(plainSchemaSeq(outputTypes) == actualDataTypes, + "Incompatible schema from pandas_udf: " + + s"expected ${outputTypes.mkString(", ")}, got ${actualDataTypes.mkString(", ")}") batch.rowIterator.asScala } } + + private def plainSchemaSeq(schema: Seq[DataType]): Seq[DataType] = { + schema.map(v => ArrowEvalPythonExec.plainSchema(v)).toList + } + +} + +private[sql] object ArrowEvalPythonExec { + /** + * Erase User-Defined Types and returns the plain Spark StructType instead. + * + * UserDefinedType: + * - will be erased as dt.sqlType Review comment: Fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org