Skip to content

Parquet dictionary filter - #286

Closed
danielcweeks wants to merge 8 commits into
apache:masterfrom
danielcweeks:parquet-dictionary-filter
Closed

Parquet dictionary filter#286
danielcweeks wants to merge 8 commits into
apache:masterfrom
danielcweeks:parquet-dictionary-filter

Conversation

@danielcweeks

Copy link
Copy Markdown

This isn't complete, but I wanted to get it out there for initial review.

I borrowed some from #270, which we can better define using this as a use case.

rdblue and others added 7 commits May 14, 2015 15:47
Author: Ryan Blue <blue@apache.org>

Closes apache#167 from rdblue/PARQUET-245-fix-travis-ci and squashes the following commits:

ccdb0b1 [Ryan Blue] PARQUET-245: Add retry to Travis CI to fix maven downloads.
f1bb713 [Ryan Blue] PARQUET-245: Only run tests in Travis CI if build succeeds.
Author: Ryan Blue <blue@apache.org>

Closes apache#186 from rdblue/PARQUET-265-update-build-for-graduation and squashes the following commits:

7bd2931 [Ryan Blue] PARQUET-265: Update POM files for Parquet TLP.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't really love this signature due to exposing the data stream as a parameter. We could reduce the entire interface to a single FilterContext, which we could then use to differentiate between the hadoop implementation and the core parquet packages. However, the DictionaryFilter does rely on seek, which is specific to the HDFS api.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think a cleaner way to do this is to pass in a dictionary page reader that returns an uncompressed dictionary page when passed a ColumnDescriptor. The DictionaryPageReader implementation would be RowGroupDictionaryPageReader and could be constructed by the ParquetFileReader. That way, the file reader can keep its place and optionally provide dictionaries for its current row group.

Getting access to an already-open ParquetFileReader would mean pushing the row group filtering into the InternalParquetRecordReader class, which I think makes sense. The ParquetRecordReader class could do Split-based row group filtering and the internal version could do data-based row group filtering. I can prototype what I'm talking about if this makes no sense.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think I understand what you're saying here. The only important thing to maintain is that we don't want to prematurely load data that we're not going to process. The most recent version of the dictionary read JIRA has something similar to what you're describing, but it requires that the row group be loaded in order to read the dictionary. This isn't effective because we want to read the dictionary prior to loading the data.

@rdblue

rdblue commented Nov 20, 2015

Copy link
Copy Markdown
Contributor

@danielcweeks, I'm doing some 1.9.0 planning. Is this something you guys would like to get in for that release? If so, would you mark the JIRA a blocker for PARQUET-392?

@danielcweeks

Copy link
Copy Markdown
Author

Just added it.

On Fri, Nov 20, 2015 at 2:52 PM, Ryan Blue notifications@github.com wrote:

@danielcweeks https://github.com/danielcweeks, I'm doing some 1.9.0
planning. Is this something you guys would like to get in for that release?
If so, would you mark the JIRA a blocker for PARQUET-392
https://issues.apache.org/jira/browse/PARQUET-392?


Reply to this email directly or view it on GitHub
#286 (comment).

@julienledem

Copy link
Copy Markdown
Member

@isnotinvain: any comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This no longer calls readAsBytesInput, which gets the page data out of an existing buffer. It also decompresses the dictionary page, which I don't think was happening before. I've been editing this a bit, and I think things end up cleaner if we don't reuse the readDictionary method here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, I think I mentioned before that this probably doesn't work. We had some discussion about trying to consolidate the dictionary read logic so it can be exposed and used by other tools.

We can probably rework this to do both.

@rdblue

rdblue commented Jan 29, 2016

Copy link
Copy Markdown
Contributor

I just had a look at the page reading part of this and will follow up tomorrow with comments on the dictionary filter.

@rdblue

rdblue commented Jan 29, 2016

Copy link
Copy Markdown
Contributor

@danielcweeks: I implemented some of the suggestions I made in my branch: https://github.com/rdblue/parquet-mr/commits/PARQUET-384-add-dictionary-filtering

That makes dictionaries accessible through a DictionaryPageReader that you get from the ParquetFileReader. The row group filter gets a dictionary reader for each block and hands that to the filter test. I think this is a bit cleaner, but I got lazy and didn't move it into the InternalParquetRecordReader where there is already a file reader. I just pass in a new file reader that's reused.

I also noticed that there are two cases that this doesn't work well for. If there is no dictionary we have to handle that in the dictionary test. Also, I think we still need to account for the case where the encoding falls back to plain. In that case, we can't eliminate the row group.

@danielcweeks

Copy link
Copy Markdown
Author

Closed in favor of: PR #330

asfgit pushed a commit that referenced this pull request Mar 9, 2016
This builds on #286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes #286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes #330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.
coughman pushed a commit to coughman/incubator-parquet-mr that referenced this pull request Apr 18, 2016
This builds on apache#286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes apache#286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes apache#330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.
piyushnarang pushed a commit to piyushnarang/parquet-mr that referenced this pull request Jun 15, 2016
This builds on apache#286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes apache#286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes apache#330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.
rdblue added a commit to rdblue/parquet-mr that referenced this pull request Jul 13, 2016
This builds on apache#286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes apache#286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes apache#330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.

Conflicts:
	parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
Resolution:
    Removed unnecessary allocator args and fields
    Minor changes for using the codec API
rdblue added a commit to rdblue/parquet-mr that referenced this pull request Jan 6, 2017
This builds on apache#286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes apache#286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes apache#330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.

Conflicts:
	parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
Resolution:
    Removed unnecessary allocator args and fields
    Minor changes for using the codec API
rdblue added a commit to rdblue/parquet-mr that referenced this pull request Jan 10, 2017
This builds on apache#286 from @danielcweeks and cleans up some of the interfaces. It introduces `DictionaryPageReadStore` to expose dictionary pages to the filters and cleans up some internal calls by passing `ParquetFileReader`.

When committed, this closes apache#286.

Author: Ryan Blue <blue@apache.org>
Author: Daniel Weeks <dweeks@netflix.com>

Closes apache#330 from rdblue/PARQUET-384-add-dictionary-filtering and squashes the following commits:

ff89424 [Ryan Blue] PARQUET-384: Add a cache to DictionaryPageReader.
1f6861c [Ryan Blue] PARQUET-384: Use ParquetFileReader to initialize readers.
21ef4b6 [Daniel Weeks] PARQUET-384: Add dictionary row group filter.

Conflicts:
	parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
Resolution:
    Removed unnecessary allocator args and fields
    Minor changes for using the codec API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants