fix(string): a STR view keeps only the bytes it points at - #631
Merged
Merged
Conversation
The descriptor views introduced for substr and `if` over STR columns pinned more than they used. An `if` whose two sides came from different pools — including two columns of one table under a where: that kept a few rows — copied BOTH whole parent pools into the result (the compacted branch inputs share the full column pool, so a 10k-row result out of 500k rows carried the two columns' 43 MB); the eager arm did the same for an unfiltered `if`. A substr with a per-row start or length retained the parent pool even when every result fitted inline and nothing pointed into it. `if` now builds a pool of exactly the chosen rows' bytes whenever the sides come from different pools, a pooled scalar is involved, or the rows keep a small share (under an eighth) of one shared pool; one shared pool whose rows keep most of it is still pointed into as before, so a derived-key expression over one column stays copy-free. A substr view whose descriptors are all inline drops its pool reference; one that points into the pool stays a view (the column is alive anyway, and a sibling `if` over two such views can then pick either side without a copy). test/rfl/strop/str_view_pool_compact.rfl pins the retained bytes through direct-bytes: an `if` under a where over two columns, over two substring views, with a pooled scalar side, the eager `if` against the two-pool sum, and an inline substr view outliving its table.
Collaborator
|
The case labelled “eager if” in |
The case labelled eager in str_view_pool_compact went through the selected path (a per-row condition column is always a row mask there), so the eager arm's two-pool offset/copy had no regression coverage. A scalar condition (a variable) is not a row mask: the selected path declines and the eager fill runs over two different pools. New cases take it at 500k rows (parallel fill) and 1000 rows (below the parallel threshold, serial fill), for both sides, check every row after all the sources are released, and bound the retained bytes to one side's pool. On the pre-fix tree the retention checks fail. The old case is relabelled as the per-row selected path it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o fix/str-view-pool-retention
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The descriptor views introduced for
substrandifover STR columns pinned more than they used. Anifwhose two sides come from different pools — including two columns of one table under awhere:that keeps a few rows — copied both whole parent pools into the result (a 10k-row result out of 500k rows carried the two columns' 43 MB); the eager arm did the same for an unfilteredif. Asubstrwith a per-row start or length retained the parent pool even when every result fitted inline and nothing pointed into it.Fix
ifbuilds a pool of exactly the chosen rows' bytes whenever the sides come from different pools, a pooled scalar is involved, or the rows keep a small share (under an eighth) of one shared pool. One shared pool whose rows keep most of it is still pointed into, so a derived-key expression over one column stays copy-free.substrview whose descriptors are all inline drops its pool reference; one that points into the pool stays a view.test/rfl/strop/str_view_pool_compact.rflpins the retained bytes throughdirect-bytes: anifunder awhereover two columns, over two substring views, with a pooled scalar side, the eagerifagainst the two-pool sum, and an inlinesubstrview outliving its table.