nizarhejazi commented on code in PR #8927:
URL: https://github.com/apache/pinot/pull/8927#discussion_r921761625


##########
pinot-core/src/main/java/org/apache/pinot/core/plan/DistinctPlanNode.java:
##########
@@ -63,14 +64,22 @@ public Operator<IntermediateResultsBlock> run() {
         Dictionary dictionary = dataSource.getDictionary();
         if (dictionary != null) {
           DataSourceMetadata dataSourceMetadata = 
dataSource.getDataSourceMetadata();
-          return new 
DictionaryBasedDistinctOperator(dataSourceMetadata.getDataType(), 
distinctAggregationFunction,
-              dictionary, dataSourceMetadata.getNumDocs());
+          // If nullHandlingEnabled is set to true, and the column contains 
null values, call DistinctOperator instead
+          // of DictionaryBasedDistinctOperator since nullValueVectorReader is 
a form of a filter.
+          // TODO: reserve special value in dictionary (e.g. -1) for null in 
the future so
+          //  DictionaryBasedDistinctOperator can be reused since it is more 
efficient than DistinctOperator for
+          //  dictionary-encoded columns.
+          NullValueVectorReader nullValueReader = 
dataSource.getNullValueVector();

Review Comment:
   Added the check and will keep the check for nullValueVector cardinality here.



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