gianm commented on code in PR #17943:
URL: https://github.com/apache/druid/pull/17943#discussion_r2060748029
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartDataSegmentProvider.java:
##########
@@ -95,7 +96,10 @@ public Supplier<ResourceHolder<CompleteSegment>>
fetchSegment(
final PhysicalSegmentInspector inspector =
segment.as(PhysicalSegmentInspector.class);
channelCounters.addFile(inspector != null ? inspector.getNumRows() :
0, 0);
});
- return new ReferenceCountingResourceHolder<>(new CompleteSegment(null,
segment), closer);
+ return new ReferenceCountingResourceHolder<>(new CompleteSegment(
+ null,
+ Objects.requireNonNull(segment.getBaseSegment())
+ ), closer);
Review Comment:
IMO a clearer comment would be:
```
// It isn't necessary to pass down the SegmentReference to CompleteSegment,
because we've
// already called segment.acquireReferences() and have attached the releaser
to "closer".
```
Btw, a side note I have realized as part of thinking about this: in native,
we apply the segment map fn first and then acquire a segment reference; whereas
with Dart we acquire the reference first and then apply the segment map fn.
IMO, the way we do it in Dart makes more sense. If native worked the same way,
then segment map fns could use `Segment` rather than `SegmentReference`, and
the call to `ReferenceCountingSegment.wrapRootGenerationSegment` in
`BaseLeafFrameProcessor` wouldn't necessary. (There is no need to change this
right now, it's fine, I'm just making an observation.)
--
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]