imply-cheddar commented on code in PR #13561:
URL: https://github.com/apache/druid/pull/13561#discussion_r1049175957


##########
processing/src/main/java/org/apache/druid/segment/nested/NestedFieldLiteralColumnIndexSupplier.java:
##########
@@ -336,17 +336,21 @@ public BitmapColumnIndex forValue(@Nullable String value)
         @Override
         public double estimateSelectivity(int totalRows)
         {
-          return (double) getBitmap(
-              
localDictionary.indexOf(stringDictionary.indexOf(StringUtils.toUtf8ByteBuffer(value)))
-          ).size() / totalRows;
+          final int globalId = 
stringDictionary.indexOf(StringUtils.toUtf8ByteBuffer(value));
+          if (globalId < 0) {
+            return 0.0;
+          }
+          return (double) getBitmap(localDictionary.indexOf(globalId)).size() 
/ totalRows;
         }
 
         @Override
         public <T> T computeBitmapResult(BitmapResultFactory<T> 
bitmapResultFactory)
         {
-          return bitmapResultFactory.wrapDimensionValue(
-              
getBitmap(localDictionary.indexOf(stringDictionary.indexOf(StringUtils.toUtf8ByteBuffer(value))))
-          );
+          final int globalId = 
stringDictionary.indexOf(StringUtils.toUtf8ByteBuffer(value));
+          if (globalId < 0) {
+            return 
bitmapResultFactory.wrapDimensionValue(bitmapFactory.makeEmptyImmutableBitmap());
+          }
+          return 
bitmapResultFactory.wrapDimensionValue(getBitmap(localDictionary.indexOf(globalId)));

Review Comment:
   Or... maybe the search query logic could change to do it on its own?  Don't 
even do it in the filter?



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