apache / apache/arrow-rs

[parquet] reduce the time spent in CachedArrayReader

Open
#9,060 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 18h
Merged PRs (30d)
169

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**

I am profiling clickbench query 26 with predicate pushdown enabled as part of
- https://github.com/apache/datafusion/issues/3463

```shell
samply record -- /Users/andrewlamb/Software/datafusion2/target/profiling/datafusion-cli -f q.sql > /dev/null 2>&1
```

```sql
SELECT "SearchPhrase" FROM hits WHERE "SearchPhrase" <> '' ORDER BY "EventTime", "SearchPhrase" LIMIT 10;
```

While looking at the profile, I noticed that 3% of the time is spent concatenating in the cached array reader

Image

I believe the call is here:
https://github.com/apache/arrow-rs/blob/814ee4227c01fce478bdd3594dd156250286b46e/parquet/src/arrow/array_reader/cached_array_reader.rs#L333

**Describe the solution you'd like**
I would like to make this faster

**Describe alternatives you've considered**
I think we can use the [`BatchCoalescer`](https://docs.rs/arrow/latest/arrow/compute/struct.BatchCoalescer.html) for this task and potentially save at least one copy

**Additional context**

Contributor guide

Open the contributing guide

Research direction

Start with parquet/src/arrow/array_reader/cached_array_reader.rs around line 333 and reproduce the ClickBench query using the provided samply command. Investigate whether BatchCoalescer can reduce concatenation cost or copying, then compare profiling results while preserving the query output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.