-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PARQUET-1328: Add Bloom filter reader and writer #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
81c3063
PARQUET-1328: Add Bloom filter reader and writer
1a0875b
Align to parquet-cpp side code and address comments
chenjunjiedada e3991ee
Rebase to latest master
chenjunjiedada 05aac07
Merge branch 'master' into PARQUET-1328
b8a0f5c
Fix conflicts after rebase and merge
chenjunjiedada 1b646a9
address comments
chenjunjiedada f03d875
address comments and fix enum issue
chenjunjiedada 4fcd761
Merge remote-tracking branch 'official/master' into PARQUET-1328
chenjunjiedada 5e4647f
Fix build issue caused by merge
894040d
test build
chenjunjiedada fb0ab5c
update check for Bloom filter reader
chenjunjiedada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ | |
| import org.apache.parquet.column.ParquetProperties; | ||
| import org.apache.parquet.column.page.PageWriteStore; | ||
| import org.apache.parquet.column.page.PageWriter; | ||
| import org.apache.parquet.column.values.bloomfilter.BloomFilterWriteStore; | ||
| import org.apache.parquet.column.values.bloomfilter.BloomFilterWriter; | ||
| import org.apache.parquet.schema.MessageType; | ||
|
|
||
| /** | ||
|
|
@@ -74,7 +76,7 @@ private interface ColumnWriterProvider { | |
| public ColumnWriter getColumnWriter(ColumnDescriptor path) { | ||
| ColumnWriterBase column = columns.get(path); | ||
| if (column == null) { | ||
| column = createColumnWriter(path, pageWriteStore.getPageWriter(path), props); | ||
| column = createColumnWriter(path, pageWriteStore.getPageWriter(path), null, props); | ||
| columns.put(path, column); | ||
| } | ||
| return column; | ||
|
|
@@ -91,7 +93,7 @@ public ColumnWriter getColumnWriter(ColumnDescriptor path) { | |
| Map<ColumnDescriptor, ColumnWriterBase> mcolumns = new TreeMap<>(); | ||
| for (ColumnDescriptor path : schema.getColumns()) { | ||
| PageWriter pageWriter = pageWriteStore.getPageWriter(path); | ||
| mcolumns.put(path, createColumnWriter(path, pageWriter, props)); | ||
| mcolumns.put(path, createColumnWriter(path, pageWriter, null, props)); | ||
| } | ||
| this.columns = unmodifiableMap(mcolumns); | ||
|
|
||
|
|
@@ -105,7 +107,38 @@ public ColumnWriter getColumnWriter(ColumnDescriptor path) { | |
| }; | ||
| } | ||
|
|
||
| abstract ColumnWriterBase createColumnWriter(ColumnDescriptor path, PageWriter pageWriter, ParquetProperties props); | ||
| // The Bloom filter is written to a specified bitset instead of pages, so it needs a separate write store abstract. | ||
| ColumnWriteStoreBase( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block could use some comments. |
||
| MessageType schema, | ||
| PageWriteStore pageWriteStore, | ||
| BloomFilterWriteStore bloomFilterWriteStore, | ||
| ParquetProperties props) { | ||
| this.props = props; | ||
| this.thresholdTolerance = (long) (props.getPageSizeThreshold() * THRESHOLD_TOLERANCE_RATIO); | ||
| Map<ColumnDescriptor, ColumnWriterBase> mcolumns = new TreeMap<>(); | ||
| for (ColumnDescriptor path : schema.getColumns()) { | ||
| PageWriter pageWriter = pageWriteStore.getPageWriter(path); | ||
| if (props.isBloomFilterEnabled() && props.getBloomFilterColumnExpectedNDVs() != null) { | ||
| BloomFilterWriter bloomFilterWriter = bloomFilterWriteStore.getBloomFilterWriter(path); | ||
| mcolumns.put(path, createColumnWriter(path, pageWriter, bloomFilterWriter, props)); | ||
| } else { | ||
| mcolumns.put(path, createColumnWriter(path, pageWriter, null, props)); | ||
| } | ||
| } | ||
| this.columns = unmodifiableMap(mcolumns); | ||
|
|
||
| this.rowCountForNextSizeCheck = props.getMinRowCountForPageSizeCheck(); | ||
|
|
||
| columnWriterProvider = new ColumnWriterProvider() { | ||
| @Override | ||
| public ColumnWriter getColumnWriter(ColumnDescriptor path) { | ||
| return columns.get(path); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| abstract ColumnWriterBase createColumnWriter(ColumnDescriptor path, PageWriter pageWriter, | ||
| BloomFilterWriter bloomFilterWriter, ParquetProperties props); | ||
|
|
||
| public ColumnWriter getColumnWriter(ColumnDescriptor path) { | ||
| return columnWriterProvider.getColumnWriter(path); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please say what this is - what do the String keys represent - columns?