Commit 6bee7e2
feat: Support stripe level batched index read (facebookincubator#480)
Summary:
X-link: facebookincubator/velox#16360
This diff implements stripe-level batched index read support for Nimble files in Velox. The key motivation is to improve index lookup performance by processing multiple lookup requests in batches at the stripe level, rather than processing each request individually.
**New `SelectiveNimbleIndexReader` class**: A format-specific index reader that handles:
- Encoding index bounds into Nimble-specific encoded keys
- Looking up stripes and row ranges using the tablet index
- Managing stripe iteration and data reading with batched processing
- Returning results in request order via an iterator pattern (`startLookup`/`hasNext`/`next`)
**Batched stripe processing**: Instead of loading stripes per-request, the reader:
- Maps all lookup requests to their matching stripes upfront
- Merges overlapping row ranges within stripes for efficient reading (without filters)
- Splits overlapping ranges into non-overlapping segments to preserve filter semantics (with filters)
- Tracks output references with ref-counting to share read data across requests
**HiveIndexReader refactoring**: Simplified to focus on index bounds creation and result assembly, delegating format-specific control logic to `SelectiveNimbleIndexReader`.
**KeyEncoder enhancements**: Added support for encoding index bounds with constant values for efficient multi-row range queries, and extended test coverage for edge cases.
**New runtime stats**: Added metrics for tracking index lookup performance:
- `kNumIndexLookupRequests`: Total lookup requests processed
- `kNumIndexLookupStripes`: Number of stripes accessed
- `kNumIndexLookupReadSegments`: Number of read segments processed
Reviewed By: HuamengJiang, tanjialiang
Differential Revision: D928489481 parent 36e5b55 commit 6bee7e2
File tree
6 files changed
+1103
-114
lines changed- dwio/nimble
- index
- tests
- velox/selective
6 files changed
+1103
-114
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
125 | | - | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
0 commit comments