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 }}
[C++] Reading and Writing RLE data from/to Parquet #32339
Parquet already supports RLE data. So this would involve adding a new (optional) code path that this data can be directly read into the new Arrow RLE arrays, without decoding it.
That would be great and a stop-gap solution would be to use RunEndDecode (expanding the array into memory first, then writing to Parquet).
If you want a more memory-efficient solution, you can look at the RunEndDecode code and write an adaptation that streams data into a plain Parquet array if required to be plain by the Parquet schema for some reason.
(Maybe the best encoding is RLE in parquet, but it might need some complex logic)
Yes, ideally we should write REE Arrow arrays as RLE Parquet arrays. It's on the level of complexity of RunEndDecode and I can help you extract common code from there if we find opportunities of re-use.
And when reading from Parquet, what can be used to build the REE Array? And how can we benifits from it?
I'm not familiar with the Parquet format, but AFAIU, it is able to store run-LENGTH encoded data, so reading that directly into a run-END encoded array would require less copying and less memory.
Maybe we could first implement (1), then regard (2) as an optimization @felipecrv ?
Yes. Sounds like a good plan.
This is the list of types supported by RunEndEncode and RunEndDecode so far. It doesn't include all nested types at the moment as I figured those would be more likely to be dict-encoded when compressed.
@jsjtxietian You can take a look at TypedColumnWriterImpl<DType>::WriteArrowDictionary, and do the same things. If you meet any problem you can ask me for that
I spent a while looking at this as I had a use case which benefits from the performance gains of directly reading Parquet RLE data into Arrow REE in-memory representation. I put up #46103 which implements this read path. It's quite a large change; let me know what you guys think. I'm also happy to split it up into smaller PRs as well.
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.
Activity
felipecrv commentedon Jun 14, 2023
RLE is now called REE.
mapleFU commentedon Jun 15, 2023
Should we first implement REE write to Plain?
And when reading from Parquet, what can be used to build the REE Array? And how can we benifits from it?
(Maybe the best encoding is RLE in parquet, but it might need some complex logic)
felipecrv commentedon Jun 15, 2023
That would be great and a stop-gap solution would be to use
RunEndDecode(expanding the array into memory first, then writing to Parquet).If you want a more memory-efficient solution, you can look at the
RunEndDecodecode and write an adaptation that streams data into a plain Parquet array if required to be plain by the Parquet schema for some reason.Yes, ideally we should write REE Arrow arrays as RLE Parquet arrays. It's on the level of complexity of
RunEndDecodeand I can help you extract common code from there if we find opportunities of re-use.I'm not familiar with the Parquet format, but AFAIU, it is able to store run-LENGTH encoded data, so reading that directly into a run-END encoded array would require less copying and less memory.
mapleFU commentedon Jun 15, 2023
I think it should take some time to implement it.
RunEndDecodeandPutinto encoder bufferRLE(RLE / bitpack): I guess it can be implemented, but currently I think it's a bit trickyMaybe we could first implement (1), then regard (2) as an optimization @felipecrv ?
felipecrv commentedon Jun 15, 2023
Yes. Sounds like a good plan.
This is the list of types supported by
RunEndEncodeandRunEndDecodeso far. It doesn't include all nested types at the moment as I figured those would be more likely to be dict-encoded when compressed.arrow/cpp/src/arrow/compute/kernels/vector_run_end_encode.cc
Lines 591 to 611 in 99dd998
mapleFU commentedon Jul 4, 2023
@jsjtxietian would you like to working on this?
jsjtxietian commentedon Jul 4, 2023
ok, will take a look this week
mapleFU commentedon Jul 10, 2023
@jsjtxietian You can take a look at
TypedColumnWriterImpl<DType>::WriteArrowDictionary, and do the same things. If you meet any problem you can ask me for thatlesterfan commentedon Apr 10, 2025
I spent a while looking at this as I had a use case which benefits from the performance gains of directly reading Parquet RLE data into Arrow REE in-memory representation. I put up #46103 which implements this read path. It's quite a large change; let me know what you guys think. I'm also happy to split it up into smaller PRs as well.
thisisnic commentedon Sep 23, 2026
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.