Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8988#discussion_r41300287
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/CatalystReadSupport.scala
 ---
    @@ -271,4 +276,30 @@ private[parquet] object CatalystReadSupport {
             .getOrElse(toParquet.convertField(f))
         }
       }
    +
    +  def expandUDT(schema: StructType): StructType = {
    +    def expand(dataType: DataType): DataType = {
    +      dataType match {
    +        case t: ArrayType =>
    +          t.copy(elementType = expand(t.elementType))
    +
    +        case t: MapType =>
    +          t.copy(
    +            keyType = expand(t.keyType),
    +            valueType = expand(t.valueType))
    +
    +        case t: StructType =>
    +          val expandedFields = t.fields.map(f => f.copy(dataType = 
expand(f.dataType)))
    +          t.copy(fields = expandedFields)
    +
    +        case t: UserDefinedType[_] =>
    +          t.sqlType
    +
    +        case t =>
    +          t
    +      }
    +    }
    +
    +    expand(schema).asInstanceOf[StructType]
    +  }
    --- End diff --
    
    Not sure whether this method is useful enough to be added as methods of all 
complex data types.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to