Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Here are a few tips to get your contribution in:
4. Make sure that your code passes the unit tests. You can run the tests with `mvn test` in the root directory.
5. Add new unit tests for your code.

If you’d like to report a bug but don’t have time to fix it, you can still post it to our [issue tracker](https://issues.apache.org/jira/browse/PARQUET), or email the mailing list (dev@parquet.incubator.apache.org).
If you’d like to report a bug but don’t have time to fix it, you can still post it to our [issue tracker](https://issues.apache.org/jira/browse/PARQUET), or email the mailing list (dev@parquet.apache.org).
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Apache Parquet MR (Incubating)
Apache Parquet MR
Copyright 2014 The Apache Software Foundation

This product includes software developed at
Expand Down
12 changes: 6 additions & 6 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Merging a pull request requires being a committer on the project.
* How to merge a Pull request:
have an apache and apache-github remote setup
```
git remote add apache-github git@github.com:apache/incubator-parquet-mr.git
git remote add apache https://git-wip-us.apache.org/repos/asf/incubator-parquet-mr.git
git remote add apache-github git@github.com:apache/parquet-mr.git
git remote add apache https://git-wip-us.apache.org/repos/asf/parquet-mr.git
```
run the following command
```
Expand All @@ -42,19 +42,19 @@ example output:
```
Which pull request would you like to merge? (e.g. 34):
```
Type the pull request number (from https://github.com/apache/incubator-parquet-mr/pulls) and hit enter.
Type the pull request number (from https://github.com/apache/parquet-mr/pulls) and hit enter.
```
=== Pull Request #X ===
title Blah Blah Blah
source repo/branch
target master
url https://api.github.com/repos/apache/incubator-parquet-mr/pulls/X
url https://api.github.com/repos/apache/parquet-mr/pulls/X

Proceed with merging pull request #3? (y/n):
```
If this looks good, type y and hit enter.
```
From git-wip-us.apache.org:/repos/asf/incubator-parquet-mr.git
From git-wip-us.apache.org:/repos/asf/parquet-mr.git
* [new branch] master -> PR_TOOL_MERGE_PR_3_MASTER
Switched to branch 'PR_TOOL_MERGE_PR_3_MASTER'

Expand All @@ -68,7 +68,7 @@ Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (36/36), 5.32 KiB, done.
Total 36 (delta 17), reused 0 (delta 0)
To git-wip-us.apache.org:/repos/asf/incubator-parquet-mr.git
To git-wip-us.apache.org:/repos/asf/parquet-mr.git
b767ac4..485658a PR_TOOL_MERGE_PR_X_MASTER -> master
Restoring head pointer to b767ac4e
Note: checking out 'b767ac4e'.
Expand Down
4 changes: 2 additions & 2 deletions dev/source-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ -z "$2" ]; then
exit
fi

version=$1-incubating
version=$1
rc=$2

if [ -d tmp/ ]; then
Expand Down Expand Up @@ -68,7 +68,7 @@ svn co --depth=empty https://dist.apache.org/repos/dist/dev/incubator/parquet tm
mkdir -p tmp/$tagrc
cp ${tarball}* tmp/$tagrc
svn add tmp/$tagrc
echo "svn ci -m 'Apache Parquet MR (Incubating) $version RC${rc}' tmp/$tagrc"
echo "svn ci -m 'Apache Parquet MR $version RC${rc}' tmp/$tagrc"

# clean up
rm -rf tmp
Expand Down
4 changes: 2 additions & 2 deletions parquet-avro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-avro</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Avro (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Avro</name>
<url>https://parquet.apache.org</url>

<properties>
<avro.version>1.7.6</avro.version>
Expand Down
4 changes: 2 additions & 2 deletions parquet-cascading/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-cascading</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Cascading (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Cascading</name>
<url>https://parquet.apache.org</url>

<repositories>
<repository>
Expand Down
4 changes: 2 additions & 2 deletions parquet-column/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-column</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Column (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Column</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-common</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Common (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Common</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-encoding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-encoding</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Encodings (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Encodings</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-generator</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Generator (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Generator</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-hadoop-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-hadoop-bundle</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Hadoop Bundle (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Hadoop Bundle</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-hadoop</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Hadoop (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Hadoop</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-hive-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-hive-bundle</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Hive Bundle (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Hive Bundle</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-0.10-binding</artifactId>
<name>Apache Parquet Hive 0.10 Binding (Incubating)</name>
<name>Apache Parquet Hive 0.10 Binding</name>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-0.12-binding</artifactId>
<name>Apache Parquet Hive 0.12 Binding (Incubating)</name>
<name>Apache Parquet Hive 0.12 Binding</name>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-binding-bundle</artifactId>
<name>Apache Parquet Hive Binding Bundle (Incubating)</name>
<name>Apache Parquet Hive Binding Bundle</name>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-binding-factory</artifactId>
<name>Apache Parquet Hive Binding Factory (Incubating)</name>
<name>Apache Parquet Hive Binding Factory</name>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-binding-interface</artifactId>
<name>Apache Parquet Hive Binding Interface (Incubating)</name>
<name>Apache Parquet Hive Binding Interface</name>
<packaging>jar</packaging>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion parquet-hive/parquet-hive-binding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>parquet-hive-binding</artifactId>
<name>Apache Parquet Hive Binding Parent (Incubating)</name>
<name>Apache Parquet Hive Binding Parent</name>
<packaging>pom</packaging>

<!-- provides javax.jdo:jdo2-api:jar:2.3-ec -->
Expand Down
4 changes: 2 additions & 2 deletions parquet-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-hive</artifactId>
<packaging>pom</packaging>

<name>Apache Parquet Hive (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Hive</name>
<url>https://parquet.apache.org</url>

<developers>
<developer>
Expand Down
4 changes: 2 additions & 2 deletions parquet-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-jackson</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Jackson (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Jackson</name>
<url>https://parquet.apache.org</url>

<dependencies>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions parquet-pig-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-pig-bundle</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Pig Bundle (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Pig Bundle</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-pig/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>parquet-pig</artifactId>
<packaging>jar</packaging>

<name>Apache Parquet Pig (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Pig</name>
<url>https://parquet.apache.org</url>

<properties>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions parquet-protobuf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
</properties>


<name>Apache Parquet Protobuf (Incubating)</name>
<url>https://parquet.incubator.apache.org</url>
<name>Apache Parquet Protobuf</name>
<url>https://parquet.apache.org</url>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public static void setRequestedProjection(Configuration configuration, String re
configuration.set(PB_REQUESTED_PROJECTION, requestedProjection);
}

/**
* Set name of protobuf class to be used for reading data.
* If no class is set, value from file header is used.
* Note that the value in header is present only if the file was written
* using parquet-protobuf project, it will fail otherwise.
* */
public static void setProtobufClass(Configuration configuration, String protobufClass) {
configuration.set(PB_CLASS, protobufClass);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an unrelated change?


@Override
public ReadContext init(InitContext context) {
String requestedProjectionString = context.getConfiguration().get(PB_REQUESTED_PROJECTION);
Expand All @@ -63,16 +73,22 @@ public ReadContext init(InitContext context) {

@Override
public RecordMaterializer<T> prepareForRead(Configuration configuration, Map<String, String> keyValueMetaData, MessageType fileSchema, ReadContext readContext) {
String strProtoClass = keyValueMetaData.get(PB_CLASS);
String headerProtoClass = keyValueMetaData.get(PB_CLASS);
String configuredProtoClass = configuration.get(PB_CLASS);

if (configuredProtoClass != null) {
LOG.debug("Replacing class " + headerProtoClass + " by " + configuredProtoClass);
headerProtoClass = configuredProtoClass;
}

if (strProtoClass == null) {
if (headerProtoClass == null) {
throw new RuntimeException("I Need parameter " + PB_CLASS + " with Protocol Buffer class");
}

LOG.debug("Reading data with Protocol Buffer class" + strProtoClass);
LOG.debug("Reading data with Protocol Buffer class " + headerProtoClass);

MessageType requestedSchema = readContext.getRequestedSchema();
Class<? extends Message> protobufClass = Protobufs.getProtobufClass(strProtoClass);
Class<? extends Message> protobufClass = Protobufs.getProtobufClass(headerProtoClass);
return new ProtoRecordMaterializer(requestedSchema, protobufClass);
}

Expand Down
2 changes: 1 addition & 1 deletion parquet-protobuf/src/main/resources/META-INF/NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Apache Parquet MR (Incubating)
Apache Parquet MR
Copyright 2014 The Apache Software Foundation

This product includes software developed at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,21 @@
package org.apache.parquet.proto;

import com.google.protobuf.Message;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.junit.Test;
import org.apache.parquet.Log;
import org.apache.parquet.proto.test.TestProtobuf;
import org.apache.parquet.proto.test.TestProtobuf.FirstCustomClassMessage;
import org.apache.parquet.proto.test.TestProtobuf.SecondCustomClassMessage;
import org.apache.parquet.proto.utils.ReadUsingMR;
import org.apache.parquet.proto.utils.WriteUsingMR;
import org.apache.parquet.proto.test.TestProtobuf;
import org.junit.Test;

import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;


public class ProtoInputOutputFormatTest {

private static final Log LOG = Log.getLog(ProtoInputOutputFormatTest.class);

/**
* Writes Protocol Buffer using first MR job, reads written file using
* second job and compares input and output.
Expand Down Expand Up @@ -95,6 +92,34 @@ public void testProjection() throws Exception {
assertTrue("Found data outside projection.", readDocument.getNameCount() == 0);
}

/**
* When user specified protobuffer class in configuration,
* It should replace class specified in header.
* */
@Test
public void testCustomProtoClass() throws Exception {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question

FirstCustomClassMessage.Builder inputMessage;
inputMessage = FirstCustomClassMessage.newBuilder();
inputMessage.setString("writtenString");

Path outputPath = new WriteUsingMR().write(new Message[]{inputMessage.build()});
ReadUsingMR readUsingMR = new ReadUsingMR();
String customClass = SecondCustomClassMessage.class.getName();
ProtoReadSupport.setProtobufClass(readUsingMR.getConfiguration(), customClass);
List<Message> result = readUsingMR.read(outputPath);

assertEquals(1, result.size());
Message msg = result.get(0);
assertFalse("Class from header returned.",
msg instanceof FirstCustomClassMessage);
assertTrue("Custom class was not used",
msg instanceof SecondCustomClassMessage);

String stringValue;
stringValue = ((SecondCustomClassMessage) msg).getString();
assertEquals("writtenString", stringValue);
}

/**
* Runs job that writes input to file and then job reading data back.
*/
Expand Down
Loading