You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2024/05/24 18:50:38 UTC
[PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
mapleFU opened a new pull request, #41819:
URL: https://github.com/apache/arrow/pull/41819
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
There're some points:
1. https://github.com/apache/arrow/blob/main/cpp/src/parquet/encoding.cc#L444-L445 . encoding is not passed in Encoder
2. But, it's RLE in decoder: https://github.com/apache/arrow/blob/main/cpp/src/parquet/encoding.cc#L1607 it will be detect and normalized in other place, like:
3. https://github.com/apache/arrow/blob/main/cpp/src/parquet/column_reader.cc#L876
We'd better unifying them
### What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Unify dict encoding to `RLE_DICTIONARY`.
### Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
No need
### Are there any user-facing changes?
No
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
-->
<!-- **This PR includes breaking changes to public APIs.** -->
<!--
Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
-->
<!-- **This PR contains a "Critical Fix".** -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2158902604
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615895931
##########
cpp/src/parquet/properties.h:
##########
@@ -1180,4 +1180,10 @@ struct ArrowWriteContext {
PARQUET_EXPORT
std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties();
+// PLAIN_DICTIONARY is deprecated but used to be used as a dictionary index
Review Comment:
Moved to `types.h` now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2163096506
After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit a81b7effd1c849953e2935f58ae6cceb18315221.
There were no benchmark performance regressions. 🎉
The [full Conbench report](https://github.com/apache/arrow/runs/26132667601) has more details. It also includes information about 20 possible false positives for unstable benchmarks that are known to sometimes produce them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1616177263
##########
cpp/src/parquet/types.h:
##########
@@ -811,4 +811,10 @@ PARQUET_EXPORT SortOrder::type GetSortOrder(ConvertedType::type converted,
PARQUET_EXPORT SortOrder::type GetSortOrder(
const std::shared_ptr<const LogicalType>& logical_type, Type::type primitive);
+/// PLAIN_DICTIONARY is deprecated but used to be used as a dictionary index
+/// encoding.
Review Comment:
Please make sure the docstring explains what the function does.
If you want to explain implementation details, regular comments (`//`) should be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1616036726
##########
cpp/src/parquet/encoding.cc:
##########
@@ -442,12 +442,12 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder<DType> {
constexpr static int32_t kDataPageBitWidthBytes = 1;
explicit DictEncoderImpl(const ColumnDescriptor* desc, MemoryPool* pool)
- : EncoderImpl(desc, Encoding::PLAIN_DICTIONARY, pool),
+ : EncoderImpl(desc, Encoding::RLE_DICTIONARY, pool),
Review Comment:
It doesn't change what we written to storage? The storage would final decided by `Properties::dictionary_index_encoding()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615728710
##########
cpp/src/parquet/properties.h:
##########
@@ -1180,4 +1180,10 @@ struct ArrowWriteContext {
PARQUET_EXPORT
std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties();
+// PLAIN_DICTIONARY is deprecated but used to be used as a dictionary index
Review Comment:
Aha, previously `dictionary_index_encoding()` is in `properties.h`. I'll move it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2160120595
Thank you @mapleFU !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615670690
##########
cpp/src/parquet/encoding.cc:
##########
@@ -442,12 +442,12 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder<DType> {
constexpr static int32_t kDataPageBitWidthBytes = 1;
explicit DictEncoderImpl(const ColumnDescriptor* desc, MemoryPool* pool)
- : EncoderImpl(desc, Encoding::PLAIN_DICTIONARY, pool),
+ : EncoderImpl(desc, Encoding::RLE_DICTIONARY, pool),
Review Comment:
IMO this is only a Parquet internal API, maybe user shouldn't depend on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615992876
##########
cpp/src/parquet/encoding.cc:
##########
@@ -442,12 +442,12 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder<DType> {
constexpr static int32_t kDataPageBitWidthBytes = 1;
explicit DictEncoderImpl(const ColumnDescriptor* desc, MemoryPool* pool)
- : EncoderImpl(desc, Encoding::PLAIN_DICTIONARY, pool),
+ : EncoderImpl(desc, Encoding::RLE_DICTIONARY, pool),
Review Comment:
Yes, but it wrote 2 (PLAIN_DICTIONARY) in the past and now 8 (RLE_DICTIONARY) for the dict indices which may not be recognized by legacy readers (though unlikely).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615548005
##########
cpp/src/parquet/encoding.cc:
##########
@@ -442,12 +442,12 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder<DType> {
constexpr static int32_t kDataPageBitWidthBytes = 1;
explicit DictEncoderImpl(const ColumnDescriptor* desc, MemoryPool* pool)
- : EncoderImpl(desc, Encoding::PLAIN_DICTIONARY, pool),
+ : EncoderImpl(desc, Encoding::RLE_DICTIONARY, pool),
Review Comment:
I'm not sure if this is a minor breaking change to those legacy readers which stick to `PLAIN_DICTIONARY`. cc @jorisvandenbossche
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2132747143
cc @wgtmac @pitrou @ClifHouck
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou merged PR #41819:
URL: https://github.com/apache/arrow/pull/41819
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2130166538
:warning: GitHub issue #41818 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1615725592
##########
cpp/src/parquet/properties.h:
##########
@@ -1180,4 +1180,10 @@ struct ArrowWriteContext {
PARQUET_EXPORT
std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties();
+// PLAIN_DICTIONARY is deprecated but used to be used as a dictionary index
Review Comment:
Why put this in `properties.h`? Perhaps `types.h` would be more appropriate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1616105241
##########
cpp/src/parquet/encoding.cc:
##########
@@ -442,12 +442,12 @@ class DictEncoderImpl : public EncoderImpl, virtual public DictEncoder<DType> {
constexpr static int32_t kDataPageBitWidthBytes = 1;
explicit DictEncoderImpl(const ColumnDescriptor* desc, MemoryPool* pool)
- : EncoderImpl(desc, Encoding::PLAIN_DICTIONARY, pool),
+ : EncoderImpl(desc, Encoding::RLE_DICTIONARY, pool),
Review Comment:
Yes, you're right. I forgot this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #41819:
URL: https://github.com/apache/arrow/pull/41819#discussion_r1616220079
##########
cpp/src/parquet/types.h:
##########
@@ -811,4 +811,10 @@ PARQUET_EXPORT SortOrder::type GetSortOrder(ConvertedType::type converted,
PARQUET_EXPORT SortOrder::type GetSortOrder(
const std::shared_ptr<const LogicalType>& logical_type, Type::type primitive);
+/// PLAIN_DICTIONARY is deprecated but used to be used as a dictionary index
+/// encoding.
Review Comment:
Ah I didn't know this, changed now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-41818: [C++][Parquet] normalize dictionary encoding to use RLE_DICTIONARY [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #41819:
URL: https://github.com/apache/arrow/pull/41819#issuecomment-2158250890
Can you rebase to get up-to-date CI results?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org