You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/12/20 19:31:15 UTC

[GitHub] [incubator-druid] jon-wei commented on a change in pull request #9063: fix vectorized query engine numeric filter matchers against null values

jon-wei commented on a change in pull request #9063: fix vectorized query engine numeric filter matchers against null values
URL: https://github.com/apache/incubator-druid/pull/9063#discussion_r360539572
 
 

 ##########
 File path: processing/src/main/java/org/apache/druid/query/filter/vector/VectorValueMatcherFactory.java
 ##########
 @@ -28,4 +29,37 @@
   VectorValueMatcher makeMatcher(@Nullable String value);
 
   VectorValueMatcher makeMatcher(DruidPredicateFactory predicateFactory);
+
+  default VectorValueMatcher makeNullValueMatcher(VectorValueSelector selector)
+  {
+    return new BaseVectorValueMatcher(selector)
+    {
+      final VectorMatch match = VectorMatch.wrap(new int[selector.getMaxVectorSize()]);
+
+      @Override
+      public ReadableVectorMatch match(final ReadableVectorMatch mask)
+      {
+        final boolean[] nullVector = selector.getNullVector();
+
+        if (nullVector == null) {
+          return VectorMatch.allFalse();
+        }
+
+        final int[] selection = match.getSelection();
+
+        int numRows = 0;
+
+        for (int i = 0; i < mask.getSelectionSize(); i++) {
+          final int rowNum = mask.getSelection()[i];
+          if (nullVector[rowNum]) {
+            selection[numRows++] = rowNum;
+          }
+        }
+
+        match.setSelectionSize(numRows);
+        assert match.isValid(mask);
 
 Review comment:
   This assert looks like it's not that cheap to compute, I wonder if we should take it out

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org