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

    https://github.com/apache/spark/pull/14014#discussion_r69696837
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala
 ---
    @@ -482,13 +482,104 @@ private[parquet] class ParquetRowConverter(
          */
         // scalastyle:on
         private def isElementType(
    -        parquetRepeatedType: Type, catalystElementType: DataType, 
parentName: String): Boolean = {
    +        parquetRepeatedType: Type, catalystElementType: DataType, parent: 
GroupType): Boolean = {
           (parquetRepeatedType, catalystElementType) match {
    -        case (t: PrimitiveType, _) => true
    -        case (t: GroupType, _) if t.getFieldCount > 1 => true
    -        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == 
"array" => true
    -        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == 
parentName + "_tuple" => true
    -        case (t: GroupType, StructType(Array(f))) if f.name == 
t.getFieldName(0) => true
    +        case (t: PrimitiveType, _) =>
    +          // For legacy 2-level list types with primitive element type, 
e.g.:
    +          //
    +          //    // List<Integer> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated int32 element;                 <-- repeatedType
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount > 1 =>
    +          // For legacy 2-level list types whose element type is a group 
type with 2 or more fields,
    +          // e.g.:
    +          //
    +          //    // List<Tuple<String, Integer>> (nullable list, non-null 
elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group element {                <-- repeatedType
    +          //        required binary str (UTF8);
    +          //        required int32 num;
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == 
"array" =>
    --- End diff --
    
    The below comment doesn't match this condition (`t.getName == "array"`)?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to