clintropolis commented on code in PR #18005:
URL: https://github.com/apache/druid/pull/18005#discussion_r2103454709


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/BaseLeafFrameProcessor.java:
##########
@@ -130,8 +130,10 @@ protected abstract ReturnOrAwait<Unit> runWithInputChannel(
    * Helper intended to be used by subclasses. Applies {@link #segmentMapFn}, 
which applies broadcast joins
    * if applicable to this query.
    */
-  protected SegmentReference mapSegment(final Segment segment)
+  protected Optional<Segment> mapSegment(final Segment segment)
   {
-    return 
segmentMapFn.apply(ReferenceCountingSegment.wrapRootGenerationSegment(segment));
+    // we use wrapUnmanaged here because segment reference tracking and 
lifecycle management happens elsewhere, so all
+    // we need to be able to do here is apply a segment map function since we 
don't care about the provider
+    return 
segmentMapFn.apply(ReferenceCountedSegmentProvider.wrapUnmanaged(segment));

Review Comment:
   yea, the segment returned by this is registered with the closer (so 
additional references acquired will be released), but we do not need to close 
the `ReferenceCountedSegmentProvider` itself that we need to wrap the `Segment` 
we provided. This was previously a problem, we were not acquiring references on 
the joinables at all, but is solved by the mapping and acquiring being part of 
the same operation now



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to