FrankChen021 commented on code in PR #20617:
URL: https://github.com/apache/druid/pull/20617#discussion_r4302649697


##########
server/src/main/java/org/apache/druid/segment/loading/PartialSegmentMetadataCacheEntry.java:
##########
@@ -1192,6 +1204,17 @@ private Optional<Segment> 
buildSegmentWithExtraClose(@Nullable Closeable extraOn
         );
       }
       index = queryableIndex;
+      if (ruleHeldOnly) {
+        // Snapshot the selection (empty when no rule is applied). The planner 
asks for bundles by name, so resolve
+        // each name the same way the bundle acquirer does, which maps __base 
to __root__ for legacy root-only segments.
+        final Set<String> selected = ruleSelectedBundleNames;
+        final PartialSegmentFileMapperV10 mapper = fileMapper;
+        servableBundles = bundleName -> selected.contains(
+            PartialSegmentBundleCacheEntry.resolveBundleName(mapper, 
bundleName)

Review Comment:
   [P2] Preserve selected projections on root-only segments
   
   **Finding:** On a legacy V10 segment whose only physical bundle is __root__, 
PartialProjectionLoadSpec records a selected projection such as p, but this 
predicate resolves the query's p request to __root__ before checking it against 
ruleSelectedBundleNames. Since the rule state still contains p, 
PARTIAL_RULE_HELD treats the selected projection as unservable and returns an 
empty cursor, silently losing rows for data the rule selected.
   
   **Suggestion:** Normalize rule selections through resolveBundleName before 
snapshotting and holding them, or compare logical and resolved names 
consistently; add a PARTIAL_RULE_HELD regression test for a root-only segment 
with a selected projection.



-- 
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