You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by GitBox <gi...@apache.org> on 2020/07/20 19:04:19 UTC

[GitHub] [parquet-mr] mauliksoneji opened a new pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

mauliksoneji opened a new pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802


   addresses https://issues.apache.org/jira/browse/PARQUET-1885


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [parquet-mr] mauliksoneji commented on pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

Posted by GitBox <gi...@apache.org>.
mauliksoneji commented on pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802#issuecomment-668748976


   Hello everyone, can someone please check this PR when you are free. Thanks in advance!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [parquet-mr] gszadovszky commented on a change in pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

Posted by GitBox <gi...@apache.org>.
gszadovszky commented on a change in pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802#discussion_r465664459



##########
File path: parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoDescriptorSupport.java
##########
@@ -0,0 +1,58 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.proto;
+
+import com.google.protobuf.Descriptors;
+import com.google.protobuf.Message;
+import com.twitter.elephantbird.util.Protobufs;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.parquet.hadoop.BadConfigurationException;
+
+public class ProtoDescriptorSupport {

Review comment:
       Could you write some comments about the purpose of this class?

##########
File path: parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoDescriptorSupport.java
##########
@@ -0,0 +1,58 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.parquet.proto;
+
+import com.google.protobuf.Descriptors;
+import com.google.protobuf.Message;
+import com.twitter.elephantbird.util.Protobufs;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.parquet.hadoop.BadConfigurationException;
+
+public class ProtoDescriptorSupport {
+
+  private Descriptors.Descriptor messageDescriptor;
+  private Class<? extends Message> protoMessage;
+
+  public ProtoDescriptorSupport(Class<? extends Message> protoMessage) {
+    this.protoMessage = protoMessage;
+  }
+
+  public ProtoDescriptorSupport(Descriptors.Descriptor messageDescriptor) {
+    this.messageDescriptor = messageDescriptor;
+  }
+
+  public Descriptors.Descriptor getMessageDescriptor(Configuration configuration) {
+    // if no protobuf descriptor was given in constructor, load descriptor from configuration (set with setProtobufClass)
+    if (protoMessage == null && messageDescriptor == null) {

Review comment:
       How this is possible while this class have only constructors that expect one of them? I think, it would be more readable and failproof if we would have a parameterless constructor that allows to be both `null` and the existing ones would expect to set them non-`null`. What do you think?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [parquet-mr] mauliksoneji commented on pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

Posted by GitBox <gi...@apache.org>.
mauliksoneji commented on pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802#issuecomment-662955559


   Also, [this previously merged commit](https://github.com/apache/parquet-mr/commit/fadbe6ef326faa5984d4d8d6df581a91c8c6cca2) was throwing an error because of unimported class. It has been fixed in my PR 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [parquet-mr] mauliksoneji commented on pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

Posted by GitBox <gi...@apache.org>.
mauliksoneji commented on pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802#issuecomment-662681612


   Hello @Fokko thank you very much for checking the PR.
   I have fixed the conflicts and pushed the code with additional tests.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [parquet-mr] Fokko commented on pull request #802: PARQUET-1885: Pass descriptor to ProtoWriteSupport constructor

Posted by GitBox <gi...@apache.org>.
Fokko commented on pull request #802:
URL: https://github.com/apache/parquet-mr/pull/802#issuecomment-662668798


   @mauliksoneji can you resolve the conflicts?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org