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

Correctly recurse into maps of maps and arrays of arrays in StructType.findNestedField

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.4.0
    • 3.5.0
    • Spark Core
    • None

    Description

      StructType.findNestedField is unable to reach nested fields below two directly nested maps or arrays. Whenever it reaches a map or an array, it'll throw an `invalidFieldName` exception if the child is not a struct.

      The following throws 'Field name `a`.`element`.element`.`i` is invalid: `a`.`element`.`element` is not a struct.', even though the access path is valid:

      val schema = new StructType()
        .add("a", ArrayType(ArrayType(
          new StructType().add("i", "int"))))
      findNestedField(Seq("a", "element", "element", "i"), schema) 

       

      Attachments

        Activity

          People

            johanl-db Johan Lasperas
            johanl-db Johan Lasperas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: