abhishekrb19 commented on code in PR #15415:
URL: https://github.com/apache/druid/pull/15415#discussion_r1402843362


##########
server/src/main/java/org/apache/druid/server/http/DataSourcesResource.java:
##########
@@ -410,7 +414,74 @@ public Response getServedSegmentsInInterval(
       }
       return Response.ok(segmentIds).build();
     }
-    return getServedSegmentsInInterval(dataSourceName, full != null, 
theInterval::contains);
+    return getServedSegmentsInInterval(dataSource, full != null, 
theInterval::contains);
+  }
+
+  @GET
+  @Path("/{dataSourceName}/unused/intervals")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ResourceFilters(DatasourceResourceFilter.class)
+  public Response 
getIntervalsWithUnusedSegmentsOrAllUnusedSegmentsPerIntervals(

Review Comment:
   I see we're following the same API patterns in this file written over a 
decade ago, but I'm wondering if it'd be better to move away from the pattern 
where an API does multiple things and returns different shapes of responses 
depending on the parameters specified. For example, in this case, IMO it'd be 
cleaner to have two different sets of API endpoints each serving only one 
functionality:
   1. `getIntervalsWithUnusedSegments()`
   2. `getUnusedSegmentsInInterval()` where the interval is optional similar to 
other parameters
   
   What do you think?



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