Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/19730#discussion_r151723565 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala --- @@ -827,4 +827,34 @@ class CastSuite extends SparkFunSuite with ExpressionEvalHelper { checkEvaluation(cast(Literal.create(input, from), to), input) } + + test("SPARK-22500: cast for struct should not generate codes beyond 64KB") { + val N = 1000 + + val from1 = new StructType( + (1 to N).map(i => StructField(s"s$i", StringType)).toArray) + val to1 = new StructType( + (1 to N).map(i => StructField(s"i$i", IntegerType)).toArray) + val input1 = Row.fromSeq((1 to N).map(i => i.toString)) + val output1 = Row.fromSeq((1 to N)) + checkEvaluation(cast(Literal.create(input1, from1), to1), output1) + + val from2 = new StructType( + (1 to N).map(i => StructField(s"a$i", ArrayType(StringType, containsNull = false))).toArray) --- End diff -- or just test this case.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org