Github user kiszk commented on a diff in the pull request: https://github.com/apache/spark/pull/19730#discussion_r151509423 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala --- @@ -1039,13 +1039,19 @@ case class Cast(child: Expression, dataType: DataType, timeZoneId: Option[String } } """ - }.mkString("\n") + } + val fieldsEvalCodes = if (ctx.INPUT_ROW != null && ctx.currentVars == null) { + ctx.splitExpressions(fieldsEvalCode, "castStruct", + ("InternalRow", ctx.INPUT_ROW) :: (rowClass, result) :: ("InternalRow", tmpRow) :: Nil) --- End diff -- Inner struct case in the following code works well. ``` val struct = Literal.create( Row( UTF8String.fromString("123.4"), Seq("456", "true", "78.9"), Row(7)), StructType(Seq( StructField("i", StringType, nullable = true), StructField("a", ArrayType(StringType, containsNull = false), nullable = true), StructField("s", StructType(Seq( StructField("i", IntegerType, nullable = true))))))) val ret = cast(struct, StructType(Seq( StructField("d", DoubleType, nullable = true), StructField("a", ArrayType(IntegerType, containsNull = true), nullable = true), StructField("s", StructType(Seq( StructField("l", LongType, nullable = true))))))) assert(ret.resolved === true) checkEvaluation(ret, Row(123.4, Seq(456, null, 78), Row(7L))) ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org