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


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -268,20 +268,28 @@ public String recommendConfig(String inputStr) {
   @Path("/tables")
   @Authorize(targetType = TargetType.CLUSTER, action = 
Actions.Cluster.GET_TABLE)
   @ApiOperation(value = "Lists all tables in cluster", notes = "Lists all 
tables in cluster")
-  public String listTables(@ApiParam(value = "realtime|offline") 
@QueryParam("type") String tableTypeStr,
+  public String listTables(@ApiParam(value = "realtime|offline|dimension") 
@QueryParam("type") String tableTypeStr,
       @ApiParam(value = "Task type") @QueryParam("taskType") String taskType,
       @ApiParam(value = "name|creationTime|lastModifiedTime") 
@QueryParam("sortType") String sortTypeStr,
       @ApiParam(value = "true|false") @QueryParam("sortAsc") 
@DefaultValue("true") boolean sortAsc) {
     try {
+      final boolean isDimensionTable = 
"dimension".equalsIgnoreCase(tableTypeStr);
       TableType tableType = null;
-      if (tableTypeStr != null) {
+      if (isDimensionTable) {
+        // Dimension is a property (isDimTable) of an OFFLINE table.
+        tableType = TableType.OFFLINE;
+      } else if (tableTypeStr != null) {
         tableType = TableType.valueOf(tableTypeStr.toUpperCase());
       }
       SortType sortType = sortTypeStr != null ? 
SortType.valueOf(sortTypeStr.toUpperCase()) : SortType.NAME;
 
-      List<String> tableNamesWithType = tableType == null ? 
_pinotHelixResourceManager.getAllTables()
-          : (tableType == TableType.REALTIME ? 
_pinotHelixResourceManager.getAllRealtimeTables()
-              : _pinotHelixResourceManager.getAllOfflineTables());
+      // If tableTypeStr is dimension, then tableType is set to 
TableType.OFFLINE.
+      // So, checking the isDimensionTable to get the list of dimension tables 
only.
+      List<String> tableNamesWithType =
+          isDimensionTable ? 
_pinotHelixResourceManager.getTableCache().getAllDimensionTables()

Review Comment:
   You may still add `getAllDimensionTables()` into `PinotHelixResourceManager` 
which can be a useful helper method



##########
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java:
##########
@@ -389,6 +389,20 @@ private List<TableConfig> getTableConfigs() {
     return tableConfigs;
   }
 
+  /**
+   * Get all dimension table names.
+   * @return List of dimension table names
+   */
+  public List<String> getAllDimensionTables() {

Review Comment:
   (minor) Move this after `getTableNameMap()` to keep public methods together



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -268,20 +268,28 @@ public String recommendConfig(String inputStr) {
   @Path("/tables")
   @Authorize(targetType = TargetType.CLUSTER, action = 
Actions.Cluster.GET_TABLE)
   @ApiOperation(value = "Lists all tables in cluster", notes = "Lists all 
tables in cluster")
-  public String listTables(@ApiParam(value = "realtime|offline") 
@QueryParam("type") String tableTypeStr,
+  public String listTables(@ApiParam(value = "realtime|offline|dimension") 
@QueryParam("type") String tableTypeStr,
       @ApiParam(value = "Task type") @QueryParam("taskType") String taskType,
       @ApiParam(value = "name|creationTime|lastModifiedTime") 
@QueryParam("sortType") String sortTypeStr,
       @ApiParam(value = "true|false") @QueryParam("sortAsc") 
@DefaultValue("true") boolean sortAsc) {
     try {
+      final boolean isDimensionTable = 
"dimension".equalsIgnoreCase(tableTypeStr);

Review Comment:
   (nit) We don't usually use `final` for local variable



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