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


##########
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java:
##########
@@ -543,13 +549,44 @@ private TableConfigInfo(TableConfig tableConfig) {
     }
   }
 
-  private static class SchemaInfo {
+  public static class SchemaInfo {
     final Schema _schema;
     final Map<String, String> _columnNameMap;
+    int _dimensionFieldSpecsCount;
+    final int _dateTimeFieldSpecsCount;
+    final int _metricFieldSpecsCount;

Review Comment:
   In order to know the dimension fields count without virtual column, we can 
deduct 3, or only cache `numDimensionFields`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -448,6 +449,13 @@ public List<InstanceConfig> getAllHelixInstanceConfigs() {
     return HelixHelper.getInstanceConfigs(_helixZkManager);
   }
 
+  /**
+   * returns server to segments count
+   */
+  public Map<String, Integer> getServerToSegmentCountMap() {
+    return _serverToSegmentCountMap;

Review Comment:
   This is not thread safe. We cannot cache this map here. In verbose mode, we 
should get the `serverToSegmentsMap` and then use it to calculate the 
`serverToSegmentCountMap` in the restlet resource



##########
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java:
##########
@@ -543,13 +549,44 @@ private TableConfigInfo(TableConfig tableConfig) {
     }
   }
 
-  private static class SchemaInfo {
+  public static class SchemaInfo {
     final Schema _schema;
     final Map<String, String> _columnNameMap;
+    int _dimensionFieldSpecsCount;
+    final int _dateTimeFieldSpecsCount;
+    final int _metricFieldSpecsCount;

Review Comment:
   Do we need to cache these values? These values can be calculated on the fly 
because schema is always loaded in memory, and the computation is very cheap.
   We can probably keep this class as is, and extract the field count info from 
the schema when the API is invoked



##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/SchemaInfo.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.spi.data;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+
+/**
+ * This class gives the details of a particular schema and the corresponding 
column metrics
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class SchemaInfo {
+  @JsonProperty("schemaName")
+  private String _schemaName;
+
+  @JsonProperty("dimensionFieldSpecsCount")
+  private int _dimensionFieldSpecsCount;

Review Comment:
   (convention) Suggest naming them `numDimensionFields`, `numMetricFields`, 
numDateTimeFields`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java:
##########
@@ -231,20 +231,26 @@ public List<Map<TableType, List<String>>> getSegments(
   @Path("segments/{tableName}/servers")
   @Authorize(targetType = TargetType.TABLE, paramName = "tableName", action = 
Actions.Table.GET_SERVER_MAP)
   @Produces(MediaType.APPLICATION_JSON)
-  @ApiOperation(value = "Get a map from server to segments hosted by the 
server",
-      notes = "Get a map from server to segments hosted by the server")
+  @ApiOperation(value = "Get a map from server to segments hosted by the 
server", notes = "Get a map from server to "
+      + "segments hosted by the server")
   public List<Map<String, Object>> getServerToSegmentsMap(
       @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
-      @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String 
tableTypeStr, @Context HttpHeaders headers) {
+      @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String 
tableTypeStr,
+      @QueryParam("detailed") @DefaultValue("true") boolean detailed, @Context 
HttpHeaders headers) {

Review Comment:
   `verbose` might be more commonly used



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