Jackie-Jiang commented on code in PR #15332:
URL: https://github.com/apache/pinot/pull/15332#discussion_r2006118744


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableViews.java:
##########
@@ -96,10 +98,17 @@ public static class TableView {
   public TableView getIdealState(
       @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
       @ApiParam(value = "realtime|offline", required = false) 
@QueryParam("tableType") String tableTypeStr,
-      @Context HttpHeaders headers) {
+      @ApiParam(value = "Comma separated segment names", required = false) 
@QueryParam("segmentNames")
+      String segmentNames, @Context HttpHeaders headers) {
     tableName = DatabaseUtils.translateTableName(tableName, headers);
     TableType tableType = validateTableType(tableTypeStr);
-    return getTableState(tableName, IDEALSTATE, tableType);
+    TableViews.TableView tableIdealStateView = getTableState(tableName, 
EXTERNALVIEW, tableType);
+    if (segmentNames != null && !segmentNames.isEmpty()) {

Review Comment:
   (minor)
   ```suggestion
       if (StringUtils.isNotEmpty(segmentNames)) {
   ```



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableViews.java:
##########
@@ -170,6 +186,21 @@ public List<SegmentStatusInfo> 
getSegmentStatuses(TableViews.TableView externalV
     return segmentStatusInfoList;
   }
 
+  public TableView getSegmentsView(TableViews.TableView tableView, 
List<String> segmentNames) {
+    TableView tableViewResult = new TableView();
+    tableViewResult._offline = new HashMap<>();
+    tableViewResult._realtime = new HashMap<>();
+    for (String segmentName : segmentNames) {
+      if (tableView._offline != null) {
+        tableViewResult._offline.put(segmentName, 
tableView._offline.get(segmentName));

Review Comment:
   This might end up having value as `null`. Is this desired?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableViews.java:
##########
@@ -96,10 +98,17 @@ public static class TableView {
   public TableView getIdealState(
       @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
       @ApiParam(value = "realtime|offline", required = false) 
@QueryParam("tableType") String tableTypeStr,
-      @Context HttpHeaders headers) {
+      @ApiParam(value = "Comma separated segment names", required = false) 
@QueryParam("segmentNames")
+      String segmentNames, @Context HttpHeaders headers) {
     tableName = DatabaseUtils.translateTableName(tableName, headers);
     TableType tableType = validateTableType(tableTypeStr);
-    return getTableState(tableName, IDEALSTATE, tableType);
+    TableViews.TableView tableIdealStateView = getTableState(tableName, 
EXTERNALVIEW, tableType);

Review Comment:
   Is this a typo? Should this be `IDEALSTATE`?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableViews.java:
##########
@@ -170,6 +186,21 @@ public List<SegmentStatusInfo> 
getSegmentStatuses(TableViews.TableView externalV
     return segmentStatusInfoList;
   }
 
+  public TableView getSegmentsView(TableViews.TableView tableView, 
List<String> segmentNames) {
+    TableView tableViewResult = new TableView();
+    tableViewResult._offline = new HashMap<>();
+    tableViewResult._realtime = new HashMap<>();

Review Comment:
   We should keep them only when they exist and not empty



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