This is an automated email from the ASF dual-hosted git repository.

9aman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new bcf3f660a14 Add getUnavailableSegments broker hook for route-level 
unavailable filtering (#18906)
bcf3f660a14 is described below

commit bcf3f660a145f6508713683c084bfca2b1ba6102
Author: Kartik Khare <[email protected]>
AuthorDate: Fri Jul 3 13:39:45 2026 +0530

    Add getUnavailableSegments broker hook for route-level unavailable 
filtering (#18906)
    
    Introduce a protected getUnavailableSegments(serverBrokerRequest, 
routeInfo) hook in
    BaseSingleStageBrokerRequestHandler. The default returns 
routeInfo.getUnavailableSegments()
    unchanged, and both read sites (the main routing path and the 
materialized-view-split fallback)
    now route through it. This lets a subclass narrow the reported unavailable 
segments to those a
    query will actually read after routing-level pruning, with no behavior 
change for OSS or existing
    tables.
    
    Co-authored-by: Kartik Khare <[email protected]>
---
 .../requesthandler/BaseSingleStageBrokerRequestHandler.java | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
 
b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
index 8ba2f5934e8..af4e6b8e6c9 100644
--- 
a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
+++ 
b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
@@ -732,7 +732,7 @@ public abstract class BaseSingleStageBrokerRequestHandler 
extends BaseBrokerRequ
 
     Set<ServerInstance> offlineExecutionServers = 
routeInfo.getOfflineExecutionServers();
     Set<ServerInstance> realtimeExecutionServers = 
routeInfo.getRealtimeExecutionServers();
-    List<String> unavailableSegments = routeInfo.getUnavailableSegments();
+    List<String> unavailableSegments = 
getUnavailableSegments(serverBrokerRequest, routeInfo);
     int numPrunedSegmentsTotal = routeInfo.getNumPrunedSegmentsTotal();
 
     // Rewrite the broker requests as the rest of the code expects them to be 
null or not based on whether the routing
@@ -913,7 +913,7 @@ public abstract class BaseSingleStageBrokerRequestHandler 
extends BaseBrokerRequ
       /// as-is — its metric was already recorded at pre-split time.
       offlineExecutionServers = routeInfo.getOfflineExecutionServers();
       realtimeExecutionServers = routeInfo.getRealtimeExecutionServers();
-      unavailableSegments = routeInfo.getUnavailableSegments();
+      unavailableSegments = getUnavailableSegments(serverBrokerRequest, 
routeInfo);
       numPrunedSegmentsTotal = routeInfo.getNumPrunedSegmentsTotal();
     }
 
@@ -2629,6 +2629,15 @@ public abstract class 
BaseSingleStageBrokerRequestHandler extends BaseBrokerRequ
       ServerStats serverStats, RequestContext requestContext)
       throws Exception;
 
+  /**
+   * Returns the segments to report as unavailable for this query. The default 
returns the route's unavailable
+   * segments unchanged. A subclass may narrow the set, e.g. to the segments 
the query will actually read after
+   * routing-level pruning, so the "segments unavailable" warning does not 
include segments the query never touches.
+   */
+  protected List<String> getUnavailableSegments(BrokerRequest 
serverBrokerRequest, TableRouteInfo routeInfo) {
+    return routeInfo.getUnavailableSegments();
+  }
+
   /// Processes an MV-split query by issuing two independent scatter-gather 
requests - one to the
   /// base table (for recent data beyond the MV boundary) and one to the 
materialized view table (for historical
   /// data up to the boundary) - then merging all returned `DataTable`s into a 
single


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

Reply via email to