You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by liancheng <gi...@git.apache.org> on 2016/07/01 11:41:55 UTC

[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

GitHub user liancheng opened a pull request:

    https://github.com/apache/spark/pull/14014

    [SPARK-16344][SQL] Decoding Parquet array of struct with a single field named "element"

    ## What changes were proposed in this pull request?
    
    This PR ports #14013 to master and branch-2.0.
    
    ## How was this patch tested?
    
    See #14013.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/liancheng/spark spark-16344-for-master-and-2.0

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/14014.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14014
    
----
commit 3bfe45fe8b81f44141b737df6b292f12cd37d06a
Author: Cheng Lian <li...@databricks.com>
Date:   2016-07-01T11:32:52Z

    Fixes SPARK-16344

----


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test FAILed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test FAILed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62059 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62059/consoleFull)** for PR 14014 at commit [`ddde8c6`](https://github.com/apache/spark/commit/ddde8c6240e7f43f82cbcffa7e31ce445246817c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    cc @yhuai 


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62051/
    Test FAILed.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70030381
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    --- End diff --
    
    Should we have a case to explicitly handle `t.getFieldCount == 0` (to make the code easier to follow)?


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r71276489
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRecordMaterializer.scala ---
    @@ -30,10 +30,11 @@ import org.apache.spark.sql.types.StructType
      * @param catalystSchema Catalyst schema of the rows to be constructed
      */
     private[parquet] class ParquetRecordMaterializer(
    -    parquetSchema: MessageType, catalystSchema: StructType)
    +    parquetSchema: MessageType, catalystSchema: StructType, schemaConverter: ParquetSchemaConverter)
    --- End diff --
    
    Add `schemaConverter` to the scaladoc?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by rdblue <gi...@git.apache.org>.
Github user rdblue commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    +1
    
    Nice work, I think we may be able to do the same thing in parquet-avro as well.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62605 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62605/consoleFull)** for PR 14014 at commit [`516a99a`](https://github.com/apache/spark/commit/516a99a32b415898423737946d5d01bc90f1241f).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70029947
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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;
    --- End diff --
    
    Also mention that `t.getFieldCount` is 2 (including `str` and `num`) for this case?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61616 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61616/consoleFull)** for PR 14014 at commit [`3bfe45f`](https://github.com/apache/spark/commit/3bfe45fe8b81f44141b737df6b292f12cd37d06a).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61837 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61837/consoleFull)** for PR 14014 at commit [`1c6e932`](https://github.com/apache/spark/commit/1c6e9328fa19e633df358be2f949c35137ea898a).


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r69700045
  
    --- 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 --
    
    Nice catch!


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61837 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61837/consoleFull)** for PR 14014 at commit [`1c6e932`](https://github.com/apache/spark/commit/1c6e9328fa19e633df358be2f949c35137ea898a).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    @yhuai All comments addressed. PR description is also updated. Thanks for the review!


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62051 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62051/consoleFull)** for PR 14014 at commit [`ddde8c6`](https://github.com/apache/spark/commit/ddde8c6240e7f43f82cbcffa7e31ce445246817c).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70030569
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    --- End diff --
    
    Probably it is good to explain why we are explicitly matching `GroupType` with `StructType` (because we are trying to determine if `GroupType` represents a Struct or just a middle layer?).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62605/
    Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62051 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62051/consoleFull)** for PR 14014 at commit [`ddde8c6`](https://github.com/apache/spark/commit/ddde8c6240e7f43f82cbcffa7e31ce445246817c).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61821 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61821/consoleFull)** for PR 14014 at commit [`5d3fdd4`](https://github.com/apache/spark/commit/5d3fdd4d31a5ddb91d4b4fd30a8a267fbe519952).


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70030343
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    --- End diff --
    
    So, when we reach here, we have `t.getFieldCount==1`? Is it possible that `t.getFieldCount == 0`?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62602/
    Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61811 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61811/consoleFull)** for PR 14014 at commit [`5d3fdd4`](https://github.com/apache/spark/commit/5d3fdd4d31a5ddb91d4b4fd30a8a267fbe519952).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62059 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62059/consoleFull)** for PR 14014 at commit [`ddde8c6`](https://github.com/apache/spark/commit/ddde8c6240e7f43f82cbcffa7e31ce445246817c).


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r69657499
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,106 @@ private[parquet] class ParquetRowConverter(
          */
         // scalastyle:on
         private def isElementType(
    -        parquetRepeatedType: Type, catalystElementType: DataType, parentName: String): Boolean = {
    +        parquetRepeatedType: Type, catalystElementType: DataType, parent: GroupType): Boolean = {
    +
    +      def isStandardListLayout(t: GroupType): Boolean =
    --- End diff --
    
    can we inline this in the pattern match


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/61821/
    Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by deepakmk9 <gi...@git.apache.org>.
Github user deepakmk9 commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    IS there any way to make this work in Spark 1.6.2 , I ma facing the same issue


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/14014


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70030627
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    +          // For legacy 2-level list types whose element type is a group type with a single field,
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    --- End diff --
    
    Also provide the Spark's corresponding StructType in this example?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    retest this please


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70415596
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaConverter.scala ---
    @@ -260,7 +260,7 @@ private[parquet] class ParquetSchemaConverter(
         {
           // For legacy 2-level list types with primitive element type, e.g.:
           //
    -      //    // List<Integer> (nullable list, non-null elements)
    +      //    // ARRAY<INT> (nullable list, non-null elements)
    --- End diff --
    
    I'm using concrete SQL types here for better readability.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    @yhuai I found more test cases that may fail even with changes made in this PR. A proper fix is delivered in the last commit. Details about the new test case and the new fix can be found in comment area of SPARK-16344.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r71277147
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -442,13 +445,23 @@ private[parquet] class ParquetRowConverter(
         private val elementConverter: Converter = {
           val repeatedType = parquetSchema.getType(0)
           val elementType = catalystSchema.elementType
    -      val parentName = parquetSchema.getName
     
    -      if (isElementType(repeatedType, elementType, parentName)) {
    +      // At this stage, we're not sure whether the repeated field maps to the element type or is
    +      // just the syntactic repeated group of the 3-level standard LIST layout. Here we try to
    +      // convert the repeated field into a Catalyst type to see whether the converted type matches
    +      // the Catalyst array element type.
    +      val guessedElementType = schemaConverter.convertField(repeatedType)
    +
    +      if (DataType.equalsIgnoreCompatibleNullability(guessedElementType, elementType)) {
    +        // If the repeated field corresponds to the element type, creates a new converter using the
    +        // type of the repeated field.
             newConverter(repeatedType, elementType, new ParentContainerUpdater {
               override def set(value: Any): Unit = currentArray += value
             })
           } else {
    +        // If the repeated field corresponds to the syntactic group in the standard 3-level Parquet
    +        // LIST layout, creates a new converter using the only child field of the repeated field.
    +        assert(!repeatedType.isPrimitive && repeatedType.asGroupType().getFieldCount == 1)
             new ElementConverter(repeatedType.asGroupType().getType(0), elementType)
    --- End diff --
    
    Can we add examples at here?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    The last build failure seems to be caused by flaky tests.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61821 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61821/consoleFull)** for PR 14014 at commit [`5d3fdd4`](https://github.com/apache/spark/commit/5d3fdd4d31a5ddb91d4b4fd30a8a267fbe519952).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by viirya <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62602 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62602/consoleFull)** for PR 14014 at commit [`c120b84`](https://github.com/apache/spark/commit/c120b849f0c3cacb4f50c545572ea602f27606b8).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62605 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62605/consoleFull)** for PR 14014 at commit [`516a99a`](https://github.com/apache/spark/commit/516a99a32b415898423737946d5d01bc90f1241f).


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r69701391
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    +          // For legacy 2-level list types whose element type is a group type with a single field,
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          //
    +          // NOTE: This kind of schema is ambiguous. According to parquet-format spec, this schema
    --- End diff --
    
    This few sentences seems can be improved to be more clear. Like: According to parquet-format spec, this schema can also be interpreted as `List<String>` if following standard 3-level list types as shown in above case branch. In order to avoid such ambiguous interpretation, we prefer standard 3-level list types and place this case after the above one. ...


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62048/
    Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/62059/
    Test PASSed.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70029907
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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
    --- End diff --
    
    Seems it is better to make the name match the variable name.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/61616/
    Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    @deepakmk9 For now, you need to rename the field. As long as it is not called `element`, it should work.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/61811/
    Test FAILed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    retest this please


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r69675124
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,106 @@ private[parquet] class ParquetRowConverter(
          */
         // scalastyle:on
         private def isElementType(
    -        parquetRepeatedType: Type, catalystElementType: DataType, parentName: String): Boolean = {
    +        parquetRepeatedType: Type, catalystElementType: DataType, parent: GroupType): Boolean = {
    +
    +      def isStandardListLayout(t: GroupType): Boolean =
    --- End diff --
    
    Done.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Let's also update the description. 


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r70029843
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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
    --- End diff --
    
    `<-- repeatedType` => `<-- parquetRepeatedType`?


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61616 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61616/consoleFull)** for PR 14014 at commit [`3bfe45f`](https://github.com/apache/spark/commit/3bfe45fe8b81f44141b737df6b292f12cd37d06a).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62048 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62048/consoleFull)** for PR 14014 at commit [`35b85ae`](https://github.com/apache/spark/commit/35b85ae16d8f0b777a954930ecb95ef6a4ec828d).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #61811 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/61811/consoleFull)** for PR 14014 at commit [`5d3fdd4`](https://github.com/apache/spark/commit/5d3fdd4d31a5ddb91d4b4fd30a8a267fbe519952).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark pull request #14014: [SPARK-16344][SQL] Decoding Parquet array of stru...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14014#discussion_r69707873
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala ---
    @@ -482,13 +482,105 @@ 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" =>
    +          // For legacy 2-level list types generated by parquet-avro (Parquet version < 1.6.0),
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group array {                  <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parent.getName + "_tuple" =>
    +          // For Parquet data generated by parquet-thrift, e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group my_list_tuple {          <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          true
    +
    +        case (t: GroupType, _)
    +            if parent.getOriginalType == LIST &&
    +              t.getFieldCount == 1 &&
    +              t.getName == "list" &&
    +              t.getFieldName(0) == "element" =>
    +          // For standard 3-level list types, e.g.:
    +          //
    +          //    // List<String> (list nullable, elements non-null)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary element (UTF8);
    +          //      }
    +          //    }
    +          //
    +          // This case branch must appear before the next one. See comments of the next case branch
    +          // for details.
    +          false
    +
    +        case (t: GroupType, StructType(fields)) =>
    +          // For legacy 2-level list types whose element type is a group type with a single field,
    +          // e.g.:
    +          //
    +          //    // List<OneTuple<String>> (nullable list, non-null elements)
    +          //    optional group my_list (LIST) {           <-- parent
    +          //      repeated group list {                   <-- repeatedType
    +          //        required binary str (UTF8);
    +          //      };
    +          //    }
    +          //
    +          // NOTE: This kind of schema is ambiguous. According to parquet-format spec, this schema
    --- End diff --
    
    Yea, the current comment is kinda contrived... Let me try again.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Let's not merge this in 2.0, unless we can get more than one person to understand the patch...



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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Merged build finished. Test PASSed.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62048 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62048/consoleFull)** for PR 14014 at commit [`35b85ae`](https://github.com/apache/spark/commit/35b85ae16d8f0b777a954930ecb95ef6a4ec828d).


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    **[Test build #62602 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/62602/consoleFull)** for PR 14014 at commit [`c120b84`](https://github.com/apache/spark/commit/c120b849f0c3cacb4f50c545572ea602f27606b8).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Thank you! I am going to merge this to master.


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

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


[GitHub] spark issue #14014: [SPARK-16344][SQL] Decoding Parquet array of struct with...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14014
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/61837/
    Test PASSed.


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

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