johnsolomonj commented on code in PR #18185:
URL: https://github.com/apache/pinot/pull/18185#discussion_r3344601728


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -279,8 +301,49 @@ public String getSegmentMetadata(
               Double indexSize = columnIndexSizes.getOrDefault(indexName, 0d) 
+ value;
               columnIndexSizes.put(indexName, indexSize);
               columnIndexSizesMap.put(column, columnIndexSizes);
+
+              indexNames.add(indexName);
+            }
+
+            // Collect per-column compression stats when feature flag is 
enabled
+            if (compressionStatsEnabled) {
+              String codec = columnMetadata.getCompressionCodec();
+              long uncompressedSize = 
columnMetadata.getUncompressedForwardIndexSizeBytes();
+              long fwdIndexSize = 
columnMetadata.getIndexSizeFor(StandardIndexes.forward());
+              if (codec != null && uncompressedSize > 0) {
+                // Raw column with stats: include in both numerator and 
denominator
+                long[] accum = columnCompressionAccum.computeIfAbsent(column, 
k -> new long[2]);
+                accum[0] += uncompressedSize;
+                accum[1] += (fwdIndexSize > 0 ? fwdIndexSize : 0);
+                columnCodecMap.merge(column, codec,
+                    (existing, incoming) -> existing.equals(incoming) ? 
existing : "MIXED");
+                // Raw columns never have a dictionary; once any segment is 
raw, mark the column as no-dict
+                columnHasDictMap.merge(column, false, (existing, incoming) -> 
false);

Review Comment:
   Good catch. Removed the hasDictionary field entirely. Codec now carries the 
full encoding information. Dict columns get codec="DICT_ENCODED", raw columns 
get the codec string (e.g. "LZ4"), and mixed segments produce codec="MIXED" 
with a per-codec breakdown. The comment and the assumption are gone.



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