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



##########
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:
       in fact, the createXX() method already checks the existence so the index 
won't be created twice on disk. I personally feel the new way is a bit less 
readable, mainly due to making a copy of Set and use Set.remove(), but lemme 
know your thoughts. 




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