bziobrowski commented on code in PR #15591:
URL: https://github.com/apache/pinot/pull/15591#discussion_r2086617103


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/ColumnMetadataImpl.java:
##########
@@ -164,10 +176,58 @@ public Set<Integer> getPartitions() {
     return _partitions;
   }
 
-  @Nullable
   @Override
-  public Map<IndexType<?, ?, ?>, Long> getIndexSizeMap() {
-    return _indexSizeMap;
+  public long getIndexSizeFor(IndexType type) {
+    short indexId = IndexService.getInstance().getNumericId(type);
+    for (int i = 0, n = getIndexTypeSizesCount(); i < n; i++) {
+      if (indexId == getIndexType(i)) {
+        return getIndexSize(i);
+      }
+    }
+
+    return INDEX_NOT_FOUND;
+  }
+
+  // size should be non-negative 48-bit value
+  public void addIndexSize(short indexType, long size) {
+    if (size < 0 || size > SIZE_MASK) {
+      throw new IllegalArgumentException(
+          "Index size should be a non-negative integer value between 0 and " + 
SIZE_MASK);
+    }
+    long typeAndSize = ((long) indexType) << 48 | (size & SIZE_MASK);
+    _indexTypeSizeList.add(typeAndSize);
+  }
+
+  @Override
+  public short getIndexType(int i) {
+    return (short) ((_indexTypeSizeList.getLong(i) >> 48) & 0xffff);
+  }
+
+  @Override
+  public long getIndexSize(int i) {
+    return (_indexTypeSizeList.getLong(i) & SIZE_MASK);
+  }
+
+  @JsonIgnore
+  @Override
+  public int getIndexTypeSizesCount() {
+    return _indexTypeSizeList.size();
+  }
+
+  // This method is only meant to retain compatibility of deserialization for
+  // /tables/{tableName}/segments/{segmentName}/metadata endpoint .
+  @SuppressWarnings("unused")
+  public JsonNode getIndexSizeMap() {

Review Comment:
   Yes, as mentioned in the comment, index size map is serialized and passed as 
part of rest endpoint result. 



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