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

Implement StructType.toString explicitly for Scala 2.13

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • SQL
    • None

    Description

      The string returned by StructType.toString is different between Scala 2.12 and 2.13.

      • Scala 2.12
        val st = StructType(StructField("a", IntegerType) :: Nil)
        st.toString
        res0: String = StructType(StructField(a,IntegerType,true)
        
      • Scala 2.13
        val st = StructType(StructField("a", IntegerType) :: Nil)
        st.toString
        val res0: String = Seq(StructField(a,IntegerType,true))
        

      It's because the logic to make the prefix of the string was changed from Scala 2.13.

      Scala 2.12: https://github.com/scala/scala/blob/v2.12.15/src/library/scala/collection/TraversableLike.scala#L804
      Scala 2:13:https://github.com/scala/scala/blob/v2.13.5/src/library/scala/collection/Seq.scala#L46

      Attachments

        Activity

          People

            sarutak Kousuke Saruta
            sarutak Kousuke Saruta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: