-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(parquet): Add config for datapage version #11151
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for meta-velox canceled.
|
40a6c6c
to
4982e1f
Compare
@yingsu00 @majetideepak Thank you for reviewing - made all necessary changes, please take a look! |
2f489a5
to
1807de1
Compare
parquet_writer_version
session property
@svm1 Arrow has two versions a user can set ParquetVersion and ParquetDataPageVersion. Based on the defaults (2.6), and the issue here prestodb/presto#22595, I see the Presto ParquetWriterVersion maps to ParquetVersion. https://github.com/apache/arrow/blob/main/cpp/src/parquet/properties.h#L258 @jkhaliqi Can you please evaluate these options with respect to RLE V2? |
I understand the two different versions - I think we had a discussion about this very debate back when I first began working on this fix, and we determined that the Presto I also investigated the Presto Java source - The Presto docs also seem to point to this mapping:
The format version also appears far more granular than simply "1 vs 2" (https://github.com/apache/parquet-format/blob/master/CHANGES.md). Therefore I believe the mapping established in this PR would be correct - please correct me if I am mistaken. |
@svm1 The issue reported here prestodb/presto#22595 hints that it is not the DataPageVersion but ParquetVersion. |
Also there are 4 ParquetVersions |
After a thorough investigation, I believe there is a misunderstanding regarding the nature of the original issue, and that the issue might not be exactly as described. The issue is based on the following observation:
However, I don't think the state of I was able to validate this by stepping through the Presto Java Parquet writer code. I observed that modifying
I observed that the @jkhaliqi and I reviewed this and conducted some experiments to understand the current behavior in Java. The following table shows the resulting value of the FormatVersion, with different values of the session property used: Presto Java:
In all cases, the resulting Parquet files (analyzed via parquet-tools) are consistently created with FormatVersion 1.0, regardless of the session property value. Additionally, we noticed that the encoding for boolean columns aligns with the expected DataPage types for each version: PARQUET_1_0/V1 file:
PARQUET_2_0/V2 file:
Therefore, I believe |
54cc8f1
to
0e470ea
Compare
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.
Let's also document this at https://facebookincubator.github.io/velox/configs.html#parquet-file-format-configuration
Should we wait until we reconcile the mapping with Presto session config? As this new flag will currently be unusable. |
4b64681
to
1bbfab7
Compare
We should document this in Velox. This can be used by other Velox applications. |
The doc for the flag should go here: https://github.com/facebookincubator/velox/blob/main/velox/docs/configs.rst#parquet-file-format-configuration |
@majetideepak @czentgr If we're doing away with Presto naming here, I think it would be less ambiguous/more intuitive to have the values for this flag be either "V1" or "V2"? As opposed to "PARQUET_1_0"/"PARQUET_2_0". |
@svm1 yes, let's use |
dcb4a9b
to
a11bd66
Compare
Documentation change pushed. |
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.
Looks great! Thanks for all the revisions and investigation @svm1
200 * 1024 * 1024, | ||
dwio::common::FileSink::Options{.pool = leafPool_.get()}); | ||
auto sinkPtr = sink.get(); | ||
parquet::WriterOptions writerOptions; |
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.
@svm1 can we use processConfigs
to ensure we test the config code path? Thanks.
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.
Great point, thanks. I originally wrote the test before you decoupled config processing logic from Hive Connector, so manually editing WriterOptions seemed like the best approach at the time. Many positive improvements from your change there :)
Rewrote the test to simulate modifying datapage flag via both config file and session property, to test the actual config code path.
cf5fd27
to
0ff765b
Compare
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.
Thanks. Lets add more tests.
}; | ||
|
||
// Simulate setting of DataPage Version via Hive config from file. | ||
std::unordered_map<std::string, std::string> configFromFile = { |
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.
I think one more tests are needed to check that the default of V1 is used without any config and when set explicitly.
This would covers all possible cases.
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.
True, expanded the tests to validate default and toggle between both versions.
{parquet::WriterOptions::kParquetHiveConnectorDataPageVersion, "V2"}}; | ||
|
||
config::ConfigBase connectorConfigV2(std::move(configFromFile)); | ||
writerOptions.processConfigs( |
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.
processConfigs can go inside testDataPageVersion
. This lambda will then take two arguments, session and config parameters.
Add config and session properties
hive.parquet.writer.datapage-version
,hive.parquet.writer.datapage_version
, to determine the parquet writer datapage version (V1 or V2). Defaults to V1.