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

Type coercion for ScalaUDFs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Seems we do not do type coercion for ScalaUDFs. The following code will hit a runtime exception.

      import org.apache.spark.sql.functions._
      val myUDF = udf((x: Int) => x + 1)
      val df = sqlContext.range(1, 10).toDF("i").select(myUDF($"i"))
      df.explain(true)
      df.show
      

      It is also good to check if we do type coercion for PythonUDFs.

        Attachments

          Activity

            People

            • Assignee:
              cheolsoo Cheolsoo Park
              Reporter:
              yhuai Yin Huai
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: