Repository navigation
GH-55281: [C++][Gandiva] Release arena memory per row when no function returns a string - #55282
Open
dmitry-chirkov-dremio wants to merge 4 commits into
Open
dmitry-chirkov-dremio wants to merge 4 commits into
dmitry-chirkov-dremio wants to merge 4 commits into
Conversation
|
|
…ena growth levenshtein returns int32 but uses arena memory, so the per-row arena release is never emitted for it. This test fails until that is fixed.
…shtein Add a kUsesArena flag, set it for levenshtein, and release the arena per row for flagged functions.
dmitry-chirkov-dremio
force-pushed
the
GH-55281-gandiva-levenshtein-arena
branch
from
October 27, 2026 05:49
d7e4af0 to
95d67a9
Compare
…d string functions An external function that takes the context and arena scratch but returns int32 still keeps its memory until the end of the batch. This test fails until that is fixed.
…unction with context Use NeedsContext() instead of the kUsesArena flag, and skip the reset call when the row did not allocate.
dmitry-chirkov-dremio
marked this pull request as ready for review
October 27, 2026 16:08
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.
Rationale for this change
Gandiva releases the arena per row only if some function returns a string. Functions that take the context but return other types (
levenshtein, external functions) keep their arena memory until the end of the batch. See #55281.What changes are included in this PR?
kNeedsContext. A function without the context cannot reach the arena.For someone who wants to follow along:
Results
Memory per batch, 262,144 rows:
levenshteinPerformance, ns/row (Apple M3, 1M rows):
divideint64divideint32castVARCHAR(s, 8)Are these changes tested?
Yes, via new targeted test with commit history showing them being effective
Considered, not chosen
kUsesArenaflag on arena users (commit 2): manual. A missed flag leaks silently.divide2x slower (0.50 to 1.07 ns/row).divideint64 3x slower (0.53 to 1.49 ns/row) on Apple M3. Any per-row store costs about 1 ns there.Are there any user-facing changes?
No.
Was AI used for this PR?
PR code and description written by:
Reviewed before submission by: