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
Parquet-MR uses Maven to build and depends on the thrift compiler (protoc is now managed by maven plugin).
To build and install the thrift compiler, run:
wget -nv http://archive.apache.org/dist/thrift/0.19.0/thrift-0.19.0.tar.gz
tar xzf thrift-0.19.0.tar.gz
cd thrift-0.19.0
chmod +x ./configure
./configure --disable-libs
sudo make install -j
If you're on OSX and use homebrew, you can instead install Thrift 0.19.0 with brew
and ensure that it comes first in your PATH
.
brew install thrift
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
Once protobuf and thrift are available in your path, you can build the project by running:
LC_ALL=C mvn clean install
Parquet is a very active project, and new features are being added quickly. Here are a few features:
- Type-specific encoding
- Hive integration (deprecated)
- Pig integration
- Cascading integration (deprecated)
- Crunch integration
- Apache Arrow integration
- Scrooge integration (deprecated)
- 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
- Java Vector API support (experimental)
The feature is experimental and is currently not part of the parquet distribution
.
Parquet-MR has supported Java Vector API to speed up reading, to enable this feature:
- Java 17+, 64-bit
- Requiring the CPU to support instruction sets:
- avx512vbmi
- avx512_vbmi2
- To build the jars:
mvn clean package -P vector-plugins
- For Apache Spark to enable this feature:
- Build parquet and replace the parquet-encoding-{VERSION}.jar on the spark jars folder
- Build parquet-encoding-vector and copy parquet-encoding-vector-{VERSION}.jar to the spark jars folder
- Edit spark class#VectorizedRleValuesReader, function#readNextGroup refer to parquet class#ParquetReadRouter, function#readBatchUsing512Vector
- Build spark with maven and replace spark-sql_2.12-{VERSION}.jar on the spark jars folder
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 integration is provided by the parquet-thrift sub-project.
Avro conversion is implemented via the parquet-avro sub-project.
Protobuf conversion is implemented via the parquet-protobuf sub-project.
- 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:
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 is provided via the parquet-hive sub-project.
Hive integration is now deprecated within the Parquet project. It is now maintained by Apache Hive.
To run the unit tests: mvn test
To build the jars: mvn package
The build runs in GitHub Actions:
The current release is version 1.13.0
<dependencies>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-common</artifactId>
<version>1.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-encoding</artifactId>
<version>1.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
<version>1.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<version>1.13.0</version>
</dependency>
</dependencies>
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 [email protected] 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 [email protected]
To contribute a patch:
- 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.
- Create a JIRA for your patch on the Parquet Project JIRA.
- 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: #240).
- Make sure that your code passes the unit tests. You can run the tests with
mvn test
in the root directory. - 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
buta + b
and notfoo(int a,int b)
butfoo(int a, int b)
. - Generally speaking, stick to the Sun Java Code Conventions
- Make sure tests pass!
Thank you for getting involved!
We hold ourselves and the Parquet developer community to two codes of conduct:
- Mailing list: [email protected]
- Bug tracker: jira
- Discussions also take place in github pull requests
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0