Repository navigation
GH-55281: [C++][Gandiva] Release arena memory per row for any function with context - #55282
Merged
kou merged 5 commits intoNov 11, 2026
Merged
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
victor6567758
added a commit
to dremio/arrow
that referenced
this pull request
Nov 3, 2026
…ack, arena release) to dremio_27.0_26_20 (#149) * DX-128210: apacheGH-55277: [C++][Gandiva] Fix decimal stack overflow with JIT optimization off (apache#55278) * DX-128210: apacheGH-55281: [C++][Gandiva] Release arena per row for any function with context (apache#55282)
lriggs
reviewed
Nov 3, 2026
lriggs
pushed a commit
to dremio/arrow
that referenced
this pull request
Nov 3, 2026
…ack, arena release) to dremio_27.0_23_19 (#150) * DX-128210: apacheGH-55277: [C++][Gandiva] Fix decimal stack overflow with JIT optimization off (apache#55278) * DX-128210: apacheGH-55281: [C++][Gandiva] Release arena per row for any function with context (apache#55282)
Contributor
Author
|
[edit Nov 6] arrow-s3fs-test timed out again in the latest run |
lriggs
approved these changes
Nov 5, 2026
Contributor
Author
|
@kou gentle nudge to review |
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
P.S. More performance details are in the comments. I didn't add a separate benchmark target - local perf runs seemed sufficient. Lmk if it would add value.
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: