Apache Parquet
Clone or download
gszadovszky and zivanfi PARQUET-1201: Column indexes (#527)
This is a squashed feature branch merge including the changes listed below. The detailed history can be found in the 'column-indexes' branch.

* PARQUET-1211: Column indexes: read/write API (#456)
* PARQUET-1212: Column indexes: Show indexes in tools (#479)
* PARQUET-1213: Column indexes: Limit index size (#480)
* PARQUET-1214: Column indexes: Truncate min/max values (#481)
* PARQUET-1364: Invalid row indexes for pages starting with nulls (#507)
* PARQUET-1310: Column indexes: Filtering (#509)
* PARQUET-1386: Fix issues of NaN and +-0.0 in case of float/double column indexes (#515)
* PARQUET-1389: Improve value skipping at page synchronization (#514)
* PARQUET-1381: Fix missing endRecord after merging columnIndex
Latest commit e7db9e2 Oct 18, 2018
Permalink
Failed to load latest commit information.
dev PARQUET-1311: Update README.md (#487) Jun 4, 2018
doc/dremel_paper removed old doc Mar 11, 2013
parquet-arrow PARQUET-1388: Nanosecond precision time and timestamp - parquet-mr (#519 Oct 4, 2018
parquet-avro PARQUET-1399: Move parquet-mr related code from parquet-format Sep 24, 2018
parquet-benchmarks [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-cascading-common23/src PARQUET-1410: Refactor modules to use the new logical type API (#520) Sep 12, 2018
parquet-cascading [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-cascading3 PARQUET-1253: Support for new logical type representation (#463) May 24, 2018
parquet-cli PARQUET-1201: Column indexes (#527) Oct 18, 2018
parquet-column PARQUET-1201: Column indexes (#527) Oct 18, 2018
parquet-common PARQUET-1201: Column indexes (#527) Oct 18, 2018
parquet-encoding [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-format-structures PARQUET-1399: Move parquet-mr related code from parquet-format Sep 24, 2018
parquet-generator [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-hadoop-bundle [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-hadoop PARQUET-1201: Column indexes (#527) Oct 18, 2018
parquet-hive-bundle [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-hive PARQUET-1410: Refactor modules to use the new logical type API (#520) Sep 12, 2018
parquet-jackson [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-pig-bundle [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-pig PARQUET-1399: Move parquet-mr related code from parquet-format Sep 24, 2018
parquet-protobuf PARQUET-1399: Move parquet-mr related code from parquet-format Sep 24, 2018
parquet-scala [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-scrooge [maven-release-plugin] prepare for next development iteration Apr 5, 2018
parquet-thrift PARQUET-1399: Move parquet-mr related code from parquet-format Sep 24, 2018
parquet-tools PARQUET-1201: Column indexes (#527) Oct 18, 2018
src adding back the license header used by the maven plugin Mar 12, 2013
.editorconfig PARQUET-740: Introduce editorconfig Oct 10, 2016
.gitignore PARQUET-480: Update for Cascading 3.0 Feb 1, 2016
.travis.yml PARQUET-1418: Run integration tests in Travis (#524) Sep 21, 2018
CHANGES.md PARQUET-1189: Update CHANGES.md for 1.10.0 release. Mar 30, 2018
KEYS PARQUET-1077: Use long key ids in KEYS file Jan 9, 2018
LICENSE PARQUET-358: Add support for Avro's logical types API. Apr 20, 2016
NOTICE PARQUET-777: Add Parquet CLI. Jul 28, 2017
PoweredBy.md PARQUET-111: Updates for apache release Feb 3, 2015
README.md [PARQUET-1135][FOLLOW-UP] Update thrift and protoc version in README.… Jun 6, 2018
changelog.sh PARQUET-252 : support nested container type for parquet-scrooge May 4, 2015
parquet_cascading.md PARQUET-480: Update for Cascading 3.0 Feb 1, 2016
pom.xml PARQUET-1388: Nanosecond precision time and timestamp - parquet-mr (#519 Oct 4, 2018

README.md

Parquet MR Build Status

Parquet-MR contains the java implementation of the Parquet format. Parquet is a columnar storage format for Hadoop; it provides efficient storage and encoding of data. Parquet uses the record shredding and assembly algorithm described in the Dremel paper to represent nested structures.

You can find some details about the format and intended use cases in our Hadoop Summit 2013 presentation

Building

Parquet-MR uses Maven to build and depends on both the thrift and protoc compilers.

Install Protobuf

To build and install the protobuf compiler, run:

wget https://github.com/google/protobuf/archive/v3.5.1.tar.gz -O protobuf-3.5.1.tar.gz
tar xzf protobuf-3.5.1.tar.gz
cd protobuf-3.5.1
./configure
make
sudo make install
sudo ldconfig

Install Thrift

To build and install the thrift compiler, run:

wget -nv http://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz
tar xzf thrift-0.9.3.tar.gz
cd thrift-0.9.3
chmod +x ./configure
./configure --disable-gen-erl --disable-gen-hs --without-ruby --without-haskell --without-erlang --without-php --without-nodejs
sudo make install

Build Parquet with Maven

Once protobuf and thrift are available in your path, you can build the project by running:

LC_ALL=C mvn clean install

Features

Parquet is a very active project, and new features are being added quickly. Here are a few features:

  • Type-specific encoding
  • Hive integration
  • Pig integration
  • Cascading integration
  • Crunch integration
  • Apache Arrow integration
  • Apache Scrooge integration
  • Impala integration (non-nested)
  • Java Map/Reduce API
  • Native Avro support
  • Native Thrift support
  • Native Protocol Buffers support
  • Complex structure support
  • Run-length encoding (RLE)
  • Bit Packing
  • Adaptive dictionary encoding
  • Predicate pushdown
  • Column stats
  • Delta encoding
  • Index pages

Map/Reduce integration

Input and Output formats. Note that to use an Input or Output format, you need to implement a WriteSupport or ReadSupport class, which will implement the conversion of your object to and from a Parquet schema.

We've implemented this for 2 popular data formats to provide a clean migration path as well:

Thrift

Thrift integration is provided by the parquet-thrift sub-project. If you are using Thrift through Scala, you may be using Twitter's Scrooge. If that's the case, not to worry -- we took care of the Scrooge/Apache Thrift glue for you in the parquet-scrooge sub-project.

Avro

Avro conversion is implemented via the parquet-avro sub-project.

Create your own objects

  • The ParquetOutputFormat can be provided a WriteSupport to write your own objects to an event based RecordConsumer.
  • the ParquetInputFormat can be provided a ReadSupport to materialize your own objects by implementing a RecordMaterializer

See the APIs:

Apache Pig integration

A Loader and a Storer are provided to read and write Parquet files with Apache Pig

Storing data into Parquet in Pig is simple:

-- options you might want to fiddle with
SET parquet.page.size 1048576 -- default. this is your min read/write unit.
SET parquet.block.size 134217728 -- default. your memory budget for buffering data
SET parquet.compression lzo -- or you can use none, gzip, snappy
STORE mydata into '/some/path' USING parquet.pig.ParquetStorer;

Reading in Pig is also simple:

mydata = LOAD '/some/path' USING parquet.pig.ParquetLoader();

If the data was stored using Pig, things will "just work". If the data was stored using another method, you will need to provide the Pig schema equivalent to the data you stored (you can also write the schema to the file footer while writing it -- but that's pretty advanced). We will provide a basic automatic schema conversion soon.

Hive integration

Hive integration is provided via the parquet-hive sub-project.

Build

To run the unit tests: mvn test

To build the jars: mvn package

The build runs in Travis CI: Build Status

Add Parquet as a dependency in Maven

The current release is version 1.10.0

  <dependencies>
    <dependency>
      <groupId>org.apache.parquet</groupId>
      <artifactId>parquet-common</artifactId>
      <version>1.10.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.parquet</groupId>
      <artifactId>parquet-encoding</artifactId>
      <version>1.10.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.parquet</groupId>
      <artifactId>parquet-column</artifactId>
      <version>1.10.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.parquet</groupId>
      <artifactId>parquet-hadoop</artifactId>
      <version>1.10.0</version>
    </dependency>
  </dependencies>

How To Contribute

We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the parquet-mr Git repository. If you've previously forked Parquet from its old location, you will need to add a remote or update your origin remote to https://github.com/apache/parquet-mr.git

If you are looking for some ideas on what to contribute, check out jira issues for this project labeled "pick-me-up". Comment on the issue and/or contact dev@parquet.apache.org with your questions and ideas.

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, or email the mailing list dev@parquet.apache.org

To contribute a patch:

  1. Break your work into small, single-purpose patches if possible. It’s much harder to merge in a large change with a lot of disjoint features.
  2. Create a JIRA for your patch on the Parquet Project JIRA.
  3. Submit the patch as a GitHub pull request against the master branch. For a tutorial, see the GitHub guides on forking a repo and sending a pull request. Prefix your pull request name with the JIRA name (ex: https://github.com/apache/parquet-mr/pull/240).
  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.

We tend to do fairly close readings of pull requests, and you may get a lot of comments. Some common issues that are not code structure related, but still important:

  • Use 2 spaces for whitespace. Not tabs, not 4 spaces. The number of the spacing shall be 2.
  • Give your operators some room. Not a+b but a + b and not foo(int a,int b) but foo(int a, int b).
  • Generally speaking, stick to the Sun Java Code Conventions
  • Make sure tests pass!

Thank you for getting involved!

Authors and contributors

Code of Conduct

We hold ourselves and the Parquet developer community to two codes of conduct:

  1. The Apache Software Foundation Code of Conduct
  2. The Twitter OSS Code of Conduct

Discussions

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 See also: