Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-32459

UDF regression of WrappedArray supporting caused by SPARK-31826

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.1.0
    • SQL
    • None

    Description

       

      test("WrappedArray") {
        val myUdf = udf((a: WrappedArray[Int]) =>
          WrappedArray.make[Int](Array(a.head + 99)))
        checkAnswer(Seq(Array(1))
          .toDF("col")
          .select(myUdf(Column("col"))),
          Row(ArrayBuffer(100)))
      }

      Execute the above test in master branch, we'll hit the error:

      [info]   org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, 192.168.101.3, executor driver): java.lang.RuntimeException: Error while decoding: java.lang.ClassCastException: scala.collection.mutable.ArrayBuffer cannot be cast to scala.collection.mutable.WrappedArray[info]  

      However, the test can be executed successfully in branch-3.0.

       

      This's actually a regression caused by SPARK-31826. And the regression happens after we changed the catalyst-to-scala converter from CatalystTypeConverters to ExpressionEncoder.deserializer .

       

      Attachments

        Issue Links

          Activity

            People

              Ngone51 wuyi
              Ngone51 wuyi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: