You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fde7e46
Browse filesBrowse the repository at this point in the historyBrowse files
introduce optional rle reads from parquet (apache#24227)
## a large portion of this PR is test!
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closesapache#123` indicates that this PR will close issue apache#123.
-->
- Closesapache#24112.
- part of apache#24111
## Rationale for this change
When DataFusion reads a parquet file with dictionary-encoded string or
binary columns, it currently decodes the dictionary and returns plain
Utf8/Binary arrays, discarding the encoding. For low-cardinality columns
(status, country, category, etc.) this doesn't take full advantage of
the compacted format parquet gives the engine Preserving the dictionary
encoding reduces memory usage and can improve aggregation performance on
these columns.
<!--
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.
Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.
For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->
## What changes are included in this PR?
Adds `datafusion.execution.parquet.enable_rle_to_dictionary` with a
default of `false`.
When enabled for inferred-schema Parquet tables, DataFusion inspects
Parquet footer metadata and promotes top-level string/binary columns
with dictionary pages to Arrow dictionary types. Mixed dictionary/plain
files are normalized before schema merge when the value types are
compatible. At scan time, the parquet opener passes the promoted schema
to arrow-rs so those columns can be read as dictionary arrays directly.
*Tables with a user-supplied schema are not promoted because DataFusion
does not use footer metadata to infer their schema.*
<!--
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.
-->
## Are these changes tested?
yes.
- `datafusion/sqllogictest/test_files/parquet_rle_to_dictionary.slt`
- `datafusion/datasource-parquet/src/schema_coercion.rs`
- `uniform_dict_schemas_respects_value_type_families` checks that mixed
file schemas are normalized only across compatible string/binary
families.
- `rle_schema_coercion_respects_dictionary_value_type` checks scan-time
coercion into dictionary types, including incompatible cases and the
flag-off path.
- `datafusion/datasource-parquet/src/opener/mod.rs`
- `test_rle_binary_column_promotion` verifies the opener passes a
promoted `Dictionary(Int32, Binary)` schema to arrow-rs so binary
columns can be read as dictionary arrays directly.
<!--
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)?
-->
## Are there any user-facing changes?
New session config option: `SET
datafusion.execution.parquet.enable_rle_to_dictionary = true`. Default
is false so existing behavior is unchanged.
<!--
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 add the `api
change` label.
-->
0 commit comments