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


##########
processing/src/main/java/org/apache/druid/segment/ColumnSelectorFactory.java:
##########
@@ -41,6 +43,19 @@ public interface ColumnSelectorFactory extends 
ColumnInspector
    */
   ColumnValueSelector makeColumnValueSelector(String columnName);
 
+  @Override
+  default int getColumnValueCardinality(String columnName)
+  {
+    final ColumnCapabilities capabilities = getColumnCapabilities(columnName);
+    if (capabilities == null) {
+      return DimensionDictionarySelector.CARDINALITY_UNKNOWN;
+    }
+    if (capabilities.is(ValueType.STRING) && 
capabilities.isDictionaryEncoded().isTrue()) {
+      final DimensionSelector dimensionSelector = 
makeDimensionSelector(DefaultDimensionSpec.of(columnName));

Review Comment:
   ok did this, I made a `GroupingSelector` interface for 
`GroupByColumnSelectorPlus` and `GroupByVectorColumnSelector` to implement for 
grouping engine cardinality computation, and reworked topn to make its 
selectorplus outside of the run method (which is nicer too since it doesnt make 
a new one for every granularity bucket, which was unnecessary after the 
previous refactor) 



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