[ 
https://issues.apache.org/jira/browse/PARQUET-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16415756#comment-16415756
 ] 

ASF GitHub Bot commented on PARQUET-968:
----------------------------------------

BenoitHanotte commented on a change in pull request #411: PARQUET-968 Add 
Hive/Presto support in ProtoParquet
URL: https://github.com/apache/parquet-mr/pull/411#discussion_r177454394
 
 

 ##########
 File path: 
parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoWriteSupport.java
 ##########
 @@ -247,21 +282,45 @@ final void writeRawValue(Object value) {
     @Override
     final void writeField(Object value) {
       recordConsumer.startField(fieldName, index);
+      recordConsumer.startGroup();
       List<?> list = (List<?>) value;
 
+      recordConsumer.startField("list", 0); // This is the wrapper group for 
the array field
       for (Object listEntry: list) {
+        recordConsumer.startGroup();
+
+        recordConsumer.startField("element", 0); // This is the mandatory 
inner field
+
+        if (!isPrimitive(listEntry)) {
+          recordConsumer.startGroup();
+        }
+
         fieldWriter.writeRawValue(listEntry);
+
+        if (!isPrimitive(listEntry)) {
+          recordConsumer.endGroup();
+        }
+
+        recordConsumer.endField("element", 0);
+
+        recordConsumer.endGroup();
       }
+      recordConsumer.endField("list", 0);
 
+      recordConsumer.endGroup();
       recordConsumer.endField(fieldName, index);
     }
   }
 
+  private boolean isPrimitive(Object listEntry) {
+    return !(listEntry instanceof Message);
 
 Review comment:
   done in https://github.com/costimuraru/parquet-mr/pull/2, I removed the 
isPrimitive method as wrapping with a group can be done in 
`MessageWriter.writeRawValue()`, removing the need to handle non-primitive 
types differently inside the ArrayWriter.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Add Hive/Presto support in ProtoParquet
> ---------------------------------------
>
>                 Key: PARQUET-968
>                 URL: https://issues.apache.org/jira/browse/PARQUET-968
>             Project: Parquet
>          Issue Type: Task
>            Reporter: Constantin Muraru
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to