snleee commented on code in PR #12346:
URL: https://github.com/apache/pinot/pull/12346#discussion_r1474230137


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -465,10 +466,64 @@ public Response downloadSegment(
     }
   }
 
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("/segments/{tableNameWithType}/{segmentName}/validDocIdsBitmap")
+  @ApiOperation(value = "Download validDocIds bitmap for an REALTIME immutable 
segment", notes =
+      "Download validDocIds for " + "an immutable segment in bitmap format.")
+  public ValidDocIdsBitmapResponse downloadValidDocIdsBitmap(
+      @ApiParam(value = "Name of the table with type REALTIME", required = 
true, example = "myTable_REALTIME")
+      @PathParam("tableNameWithType") String tableNameWithType,
+      @ApiParam(value = "Name of the segment", required = true) 
@PathParam("segmentName") @Encoded String segmentName,
+      @Context HttpHeaders httpHeaders) {
+    segmentName = URIUtils.decode(segmentName);
+    LOGGER.info("Received a request to download validDocIds for segment {} 
table {}", segmentName, tableNameWithType);
+    // Validate data access
+    ServerResourceUtils.validateDataAccess(_accessControlFactory, 
tableNameWithType, httpHeaders);
+
+    TableDataManager tableDataManager =
+        ServerResourceUtils.checkGetTableDataManager(_serverInstance, 
tableNameWithType);
+    SegmentDataManager segmentDataManager = 
tableDataManager.acquireSegment(segmentName);
+    if (segmentDataManager == null) {
+      throw new WebApplicationException(
+          String.format("Table %s segment %s does not exist", 
tableNameWithType, segmentName),
+          Response.Status.NOT_FOUND);
+    }
+
+    try {
+      IndexSegment indexSegment = segmentDataManager.getSegment();
+      if (!(indexSegment instanceof ImmutableSegmentImpl)) {
+        throw new WebApplicationException(
+            String.format("Table %s segment %s is not a immutable segment", 
tableNameWithType, segmentName),
+            Response.Status.BAD_REQUEST);
+      }
+
+      // Adopt the same logic as the query execution to get the valid doc ids. 
'FilterPlanNode.run()'

Review Comment:
   added `validDocIdType`. Can you review the code?



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to