-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PARQUET-353: Recycle compressors in parquet write path #282
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -341,7 +341,6 @@ public RecordWriter<Void, T> getRecordWriter(Configuration conf, Path file, Comp | |
| throws IOException, InterruptedException { | ||
| final WriteSupport<T> writeSupport = getWriteSupport(conf); | ||
|
|
||
| CodecFactory codecFactory = new CodecFactory(conf); | ||
| long blockSize = getLongBlockSize(conf); | ||
|
Member
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. I don't get this change. the creation has been moved to ParquetFileWriter w = new ParquetFileWriter(... just a few lines bellow. Could you explain why we do this? |
||
| if (INFO) LOG.info("Parquet block size to " + blockSize); | ||
| int pageSize = getPageSize(conf); | ||
|
|
@@ -379,7 +378,7 @@ public RecordWriter<Void, T> getRecordWriter(Configuration conf, Path file, Comp | |
| init.getSchema(), | ||
| init.getExtraMetaData(), | ||
| blockSize, pageSize, | ||
| codecFactory.getCompressor(codec, pageSize), | ||
| w.getCodecFactory().getCompressor(codec, pageSize), | ||
| dictionaryPageSize, | ||
| enableDictionary, | ||
| validating, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -267,8 +267,7 @@ public ParquetWriter(Path file, Configuration conf, WriteSupport<T> writeSupport | |
| conf, schema, file, mode, blockSize, maxPaddingSize); | ||
| fileWriter.start(); | ||
|
|
||
| CodecFactory codecFactory = new CodecFactory(conf); | ||
| CodecFactory.BytesCompressor compressor = codecFactory.getCompressor(compressionCodecName, 0); | ||
| CodecFactory.BytesCompressor compressor = fileWriter.getCodecFactory().getCompressor(compressionCodecName, 0); | ||
|
Member
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. possibly what you really want is pass the codec factory as a parameter to this constructor. |
||
| this.writer = new InternalParquetRecordWriter<T>( | ||
| fileWriter, | ||
| writeSupport, | ||
|
|
||
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.
It seems that this is not the right place to put this as this class does not use the codecFactory.
it just creates it and makes it available. I'd rather have private members not accessible to the outside to respect encapsulation and layering of the code.
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.
+1