clintropolis commented on code in PR #12388:
URL: https://github.com/apache/druid/pull/12388#discussion_r866538545


##########
processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java:
##########
@@ -193,30 +194,36 @@ private ColumnAnalysis analyzeNumericColumn(
 
   private ColumnAnalysis analyzeStringColumn(
       final ColumnCapabilities capabilities,
-      final ColumnHolder columnHolder
+      final ColumnHolder columnHolder,
+      final String columnName
   )
   {
     Comparable min = null;
     Comparable max = null;
     long size = 0;
     final int cardinality;
     if (capabilities.hasBitmapIndexes()) {
-      final BitmapIndex bitmapIndex = columnHolder.getBitmapIndex();
-      cardinality = bitmapIndex.getCardinality();
-
-      if (analyzingSize()) {
-        for (int i = 0; i < cardinality; ++i) {
-          String value = bitmapIndex.getValue(i);
-          if (value != null) {
-            size += StringUtils.estimatedBinaryLengthAsUTF8(value) *
-                    ((long) bitmapIndex.getBitmapForValue(value).size());
+      ColumnIndexSupplier indexSupplier = columnHolder.getIndexSupplier();
+      if (indexSupplier != null) {
+        final DictionaryEncodedStringValueIndex valueIndex = 
indexSupplier.getIndex(
+            DictionaryEncodedStringValueIndex.class
+        );
+        Preconditions.checkNotNull(valueIndex, "Column [%s] does not have a 
value index", columnName);
+        cardinality = valueIndex.getCardinality();
+        if (analyzingSize()) {
+          for (int i = 0; i < cardinality; ++i) {
+            String value = valueIndex.getValue(i);

Review Comment:
   ah, I completely agree this is silly, but I have bigger plans with plumbing 
through the utf8 bytes into filters, so do you mind if I save this for a 
follow-up PR?



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