[
https://issues.apache.org/jira/browse/PARQUET-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17171438#comment-17171438
]
ASF GitHub Bot commented on PARQUET-1885:
-----------------------------------------
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:
[email protected]
> [parquet-protobuf] Pass descriptor to ProtoWriteSupport constructor
> --------------------------------------------------------------------
>
> Key: PARQUET-1885
> URL: https://issues.apache.org/jira/browse/PARQUET-1885
> Project: Parquet
> Issue Type: Improvement
> Components: parquet-mr
> Affects Versions: 1.11.0, 1.10.1
> Reporter: Maulik Soneji
> Priority: Major
>
> Currently, the ProtoWriteSupport class checks for Descriptor by calling
> `Protobufs.getMessageDescriptor` function which checks for descriptor in the
> classpath. There is no way to pass descriptor as an argument to the
> ProtoWriteSupport constructor.
> In our approach to using parquet-mr library, we are using a descriptor that
> is not available in the classpath.
> I will be happy to work on adding this support to the parquet-mr library.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)