klsince commented on a change in pull request #7286:
URL: https://github.com/apache/pinot/pull/7286#discussion_r696832920



##########
File path: 
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessor.java
##########
@@ -112,31 +111,23 @@ public void process()
       rangeIndexHandler.createRangeIndices();
 
       // Create text indices according to the index config.
-      Set<String> textIndexColumns = _indexLoadingConfig.getTextIndexColumns();
-      if (!textIndexColumns.isEmpty()) {
-        TextIndexHandler textIndexHandler =
-            new TextIndexHandler(_indexDir, _segmentMetadata, 
textIndexColumns, segmentWriter);
-        textIndexHandler.createTextIndexesOnSegmentLoad();
-      }
+      TextIndexHandler textIndexHandler =
+          new TextIndexHandler(_indexDir, _segmentMetadata, 
_indexLoadingConfig, segmentWriter);
+      textIndexHandler.createTextIndexesOnSegmentLoad();

Review comment:
       actually, those createXXX() method right now indeed just adds indices, 
as the removal happens in the constructor. but think I can move removal logic 
into the updateXXX() method.

##########
File path: 
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/bloomfilter/BloomFilterHandler.java
##########
@@ -67,12 +67,20 @@ public BloomFilterHandler(File indexDir, 
SegmentMetadataImpl segmentMetadata, In
     _segmentVersion = segmentMetadata.getVersion();
     _bloomFilterConfigs = indexLoadingConfig.getBloomFilterConfigs();
 
-    for (String column : _bloomFilterConfigs.keySet()) {
+    Set<String> columnsInCfg = _bloomFilterConfigs.keySet();
+    for (String column : columnsInCfg) {
       ColumnMetadata columnMetadata = 
segmentMetadata.getColumnMetadataFor(column);
       if (columnMetadata != null) {
         _bloomFilterColumns.add(columnMetadata);
       }
     }
+    // Remove indices not set in table config any more
+    Set<String> localColumns = 
_segmentWriter.toSegmentDirectory().getColumnsWithIndex(ColumnIndexType.BLOOM_FILTER);
+    for (String column : localColumns) {
+      if (!columnsInCfg.contains(column)) {
+        _segmentWriter.removeIndex(column, ColumnIndexType.BLOOM_FILTER);
+      }
+    }

Review comment:
       cool!




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to