- Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Fix double release in inline stats when LocalRelation
is reused #136467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ESQL: Fix double release in inline stats when LocalRelation
is reused #136467
Conversation
- Replace `LocalSupplier.of` with new `CopyingLocalSupplier` in `PruneColumns` - Add `INLINE_STATS_AFTER_PRUNED_AGGREGATE` capability - Add test cases for inline stats after aggregate pruning
Pinging @elastic/es-analytical-engine (Team:Analytics) |
LocalRelation
is reused @kanoshiou thanks for this patch! I'm however thinking if we shouldn't have another approach here: instead of patching the optimiser rules to use the @astefan, WDYT? |
@kanoshiou Your changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, look into @bpintea's suggestion for a less invasive and more targeted approach to this bug fix. Please, let us know if you are able to work on this bug fix in short time, otherwise we are ready to take it over. Thank you.
When the optimizer creates a
LocalRelation
usingLocalSupplier.of()
(which delegates toImmediateLocalSupplier
), the same page instance can be referenced and released multiple times during inline stats execution. This happens because theLocalRelation
serves as a source for both sides of theInlineJoin
- once for the left-hand side and again for the right-hand side, causing a double release error and connection closure.This PR introduces a
MaterializeInlineJoinData
optimizer rule that runs in thecleanup
phase and transforms anyLocalRelation
nodes on theInlineJoin
left-hand side to useCopyingLocalSupplier
if they don't already.Closes #135679