You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/07/08 23:44:16 UTC

[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #5667: Support text index on dictionary encoded columns

siddharthteotia commented on a change in pull request #5667:
URL: https://github.com/apache/incubator-pinot/pull/5667#discussion_r451884394



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/inv/text/LuceneTextIndexCreator.java
##########
@@ -115,14 +115,31 @@ public IndexWriter getIndexWriter() {
 
   @Override
   public void addDoc(Object document, int docIdCounter) {
-    Document docToIndex = new Document();
-    docToIndex.add(new TextField(_textColumn, document.toString(), Field.Store.NO));
-    docToIndex.add(new StoredField(LUCENE_INDEX_DOC_ID_COLUMN_NAME, docIdCounter));
-    try {
-      _indexWriter.addDocument(docToIndex);
-    } catch (Exception e) {
-      LOGGER.error("Failure while adding a new document to index for column {}, exception {}", _textColumn, e.getMessage());
-      throw new RuntimeException(e);
+    if (!(document instanceof Object[])) {
+      // text index on SV column
+      Document docToIndex = new Document();
+      docToIndex.add(new TextField(_textColumn, document.toString(), Field.Store.NO));
+      docToIndex.add(new StoredField(LUCENE_INDEX_DOC_ID_COLUMN_NAME, docIdCounter));
+      try {
+        _indexWriter.addDocument(docToIndex);
+      } catch (Exception e) {
+        LOGGER.error("Failure while adding a new document to index for column {}, exception {}", _textColumn, e.getMessage());
+        throw new RuntimeException(e);
+      }
+    } else {
+      // text index on MV column
+      Object[] values = (Object[])document;
+      for (Object value : values) {
+        Document docToIndex = new Document();

Review comment:
       In order to fix this issue https://github.com/apache/incubator-pinot/issues/5666 sooner, I am only relaxing the constraint of text index on raw columns in this PR. The constraint of text index on SV columns is still there and will address in a follow-up. Need to do some digging into Lucene as well to see how arrays can be stored in a single document etc. 




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



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