You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/10/29 08:33:26 UTC

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #466: [IOTDB-208] Bloom filter

qiaojialin commented on a change in pull request #466: [IOTDB-208] Bloom filter
URL: https://github.com/apache/incubator-iotdb/pull/466#discussion_r339934761
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/query/executor/TsFileExecutor.java
 ##########
 @@ -54,6 +58,25 @@ public TsFileExecutor(IMetadataQuerier metadataQuerier, IChunkLoader chunkLoader
 
   @Override
   public QueryDataSet execute(QueryExpression queryExpression) throws IOException {
+    // bloom filter
+    BloomFilter bloomFilter = metadataQuerier.getWholeFileMetadata().getBloomFilter();
+    List<Path> filteredSeriesPath = new ArrayList<>();
+    if (bloomFilter != null) {
+      for (Path path : queryExpression.getSelectedSeries()) {
+        if (bloomFilter.contains(path.getFullPath())) {
+          filteredSeriesPath.add(path);
+        } else {
+          // If one path is not contains in this tsfile, return empty set
+          LOG.debug(
+              "This tsfile not contains paths " + path
+                  + " which specified in selected series, return empty dataset");
+          return new DataSetWithoutTimeGenerator(Collections.emptyList(), Collections.emptyList(),
+              Collections.emptyList());
+        }
+      }
+    }
+    queryExpression.setSelectSeries(filteredSeriesPath);
+    //
 
 Review comment:
   remove this or add comment

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