You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by an...@apache.org on 2024/02/22 08:04:24 UTC

(pinot) branch master updated: bugfix: re-add support for `not text_match` (#12372)

This is an automated email from the ASF dual-hosted git repository.

ankitsultana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 839a91edae bugfix: re-add support for `not text_match` (#12372)
839a91edae is described below

commit 839a91edae106d82235ed627c335cdf03be45c30
Author: Christopher Peck <27...@users.noreply.github.com>
AuthorDate: Thu Feb 22 00:04:17 2024 -0800

    bugfix: re-add support for `not text_match` (#12372)
---
 .../core/operator/filter/TextMatchFilterOperator.java  |  3 +--
 .../apache/pinot/queries/TextSearchQueriesTest.java    | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/TextMatchFilterOperator.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/TextMatchFilterOperator.java
index 5c791eb3e6..8a668f593d 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/TextMatchFilterOperator.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/TextMatchFilterOperator.java
@@ -43,8 +43,7 @@ public class TextMatchFilterOperator extends BaseFilterOperator {
   private final TextMatchPredicate _predicate;
 
   public TextMatchFilterOperator(TextIndexReader textIndexReader, TextMatchPredicate predicate, int numDocs) {
-    // This filter operator does not support AND/OR/NOT operations.
-    super(0, false);
+    super(numDocs, false);
     _textIndexReader = textIndexReader;
     _predicate = predicate;
     _numDocs = numDocs;
diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java b/pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
index ea164c0e6a..df1b8a790f 100644
--- a/pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/queries/TextSearchQueriesTest.java
@@ -1330,6 +1330,24 @@ public class TextSearchQueriesTest extends BaseQueriesTest {
     testTextSearchAggregationQueryHelper(query, expected.size());
   }
 
+  /**
+   * Test NotFilterOperator with index based doc id iterator (text_match)
+   * @throws Exception
+   */
+  @Test
+  public void testTextSearchWithInverse()
+      throws Exception {
+
+    // all skills except the first 28 in createTestData contain 'software engineering' or ('software' and 'engineering')
+    List<Object[]> expected = new ArrayList<>();
+    for (int i = 0; i < 28; i++) {
+      expected.add(new Object[]{1000 + i});
+    }
+
+    String query = "SELECT INT_COL FROM MyTable WHERE NOT TEXT_MATCH(SKILLS_TEXT_COL, 'software') LIMIT 50000";
+    testTextSearchSelectQueryHelper(query, 28, false, expected);
+  }
+
   /**
    * Test the reference counting mechanism of {@link SearcherManager}
    * used by {@link RealtimeLuceneTextIndex}


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