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

Row encoder should accept optional types

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.0.0, 2.1.0, 2.2.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      Since Spark 2.0 Spark doesn't accept optional types with `RowEncoder`:

      import org.apache.spark.sql.types._
      import org.apache.spark.sql.Row
      
      spark.createDataFrame(
        sc.parallelize(Seq(Row(None))),
        StructType(Seq(StructField("v", StringType, true)))
      ).first
      
      // Caused by: java.lang.RuntimeException: Error while encoding: java.lang.RuntimeException: scala.None$ is not a valid external type for schema of string
      
      
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              e89ff95a e89ff95a
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: