npawar commented on a change in pull request #6211:
URL: https://github.com/apache/incubator-pinot/pull/6211#discussion_r517706823



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java
##########
@@ -558,4 +558,32 @@ public RebalanceResult rebalance(
       throw new ControllerApplicationException(LOGGER, e.getMessage(), 
Response.Status.NOT_FOUND);
     }
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("/tables/{tableName}/state")
+  @ApiOperation(value = "Get current table state", notes = "Get current table 
state")
+  public String getTableState(
+      @ApiParam(value = "Name of the table to get its state", required = true) 
@PathParam("tableName") String tableName,
+      @ApiParam(value = "realtime|offline", required = true) 
@QueryParam("type") String tableTypeStr
+  ) {
+    TableType tableType;
+    try {
+      tableType = TableType.valueOf(tableTypeStr.toUpperCase());
+    } catch (IllegalArgumentException e) {
+      throw new ControllerApplicationException(LOGGER, "Illegal table type: " 
+ tableTypeStr,
+          Response.Status.BAD_REQUEST);
+    }
+
+    String tableNameWithType = 
TableNameBuilder.forType(tableType).tableNameWithType(tableName);
+    try {
+      ObjectNode data = JsonUtils.newObjectNode();
+      data.put("tableName", tableNameWithType);

Review comment:
       we dont need to again return tableName in the response do we? You can 
just return "enabled" or "disabled".




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

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