Repository navigation
Commit 3639eae
authored
perf(cpp): bulk-copy contiguous boundary pages and decode aligned pages in place (#1096)
* perf(cpp): bulk-copy contiguous boundary pages and decode aligned pages in place
The aligned chunk reader bulk-copied FULL_PASS pages only. A page can also be
fully matched while classified BOUNDARY: under a contiguous time predicate
(TimeBetween without negation) every timestamp inside the page's retained
[row_begin, row_end] range passes, so the range can be copied as a block
instead of re-checking and appending row by row. Discrete predicates (TimeIn)
and negated forms keep the row-by-row path, and a FIELD predicate keeps it
too: a page mask can still reject rows inside the retained range.
Second, on the page-plan path the leading pages whose output rows fit in the
current TsBlock are now decoded straight into the destination column buffers
instead of a per-page staging buffer that is copied afterwards. That needs a
fixed destination address, so it applies only to fixed-length columns, only
when a page is retained from row 0 through its end, and only to the prefix
that the scatter consumes from the same block; eager (parallel) decode can
use it for every page that fits. Pages with nulls, partial ranges and
variable-length columns keep their staging buffers.
ByteBuffer gains set_data_size() to declare bytes written directly through
get_data().
On a scan of 200k rows x 8 INT64 columns with a window covering the middle
half, 64 KiB pages and the default block size, a full read takes 2.08 ms
instead of 2.39 ms per scan. With 4 KiB pages the read is I/O bound and the
change is neutral (5.1 ms both ways).
* test(cpp): count bulk-copied pages once each
TEST_bulk_page_count() counted bulk-copy operations, so a page split across
several calls (small destination block) was counted more than once. Count a
page when its first bulk operation starts, and have the test read the
cumulative counter as a delta instead of adding it up per call.
Also scope the skip macro comment to the tests that actually need a decode
pool; the FIELD filter test reaches the page plan either way.
* fix(cpp): derive the direct-decode offset from the rows the scatter emits
A page inside the direct-decode prefix that cannot be written in place (it
carries nulls, or its retained range is shorter than the page) still has to
reserve space in the destination column, because the pages after it were
already decoded at offsets computed from it. The reservation used the whole
page's non-null count; derive it from the non-null values in
[row_begin, row_end) instead, which is exactly what the scatter appends for
that page, so the offsets stay right whatever mix of pages the prefix holds.
Also fix the comment to use the half-open [row_begin, row_end) range, and
let read_all() zero its out parameters so callers need not pre-zero them.
* test(cpp): harden the aligned bulk-copy test setup
Give each case's file a wall-clock suffix so parallel or repeated runs
cannot collide on the name, take the shared aligned time chunk from the
first index and assert the rest agree instead of silently overwriting it,
and stop the read helper on a failed load or block init instead of
asserting further against an unusable block.
* test(cpp): avoid clashing fixture file names across concurrent cases
The CI run for this PR failed in HotDeviceMetadataTest.RepeatedLookups...
with the fixture's open() returning E_ALREADY_EXIST, and the test body then
segfaulted on the unopened writer. The name is seeded from the wall clock,
and cases of one suite run as separate processes in a shared directory
(ctest --parallel), so two of them can land on the same seed and race on
open() with O_EXCL. Seed from random_device instead, and assert the open so
a failure is reported rather than crashing the body.1 parent 10626d0 commit 3639eae
7 files changed
Lines changed: 694 additions & 29 deletions
File tree
- cpp
- src
- common/container
- reader
- filter
- test/reader
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
| |||
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
180 | 203 | | |
181 | 204 | | |
182 | 205 | | |
| |||
274 | 297 | | |
275 | 298 | | |
276 | 299 | | |
| 300 | + | |
277 | 301 | | |
278 | 302 | | |
279 | 303 | | |
| |||
346 | 370 | | |
347 | 371 | | |
348 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
349 | 389 | | |
350 | 390 | | |
351 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
0 commit comments