lukasz-antoniak commented on code in PR #211:
URL: 
https://github.com/apache/cassandra-analytics/pull/211#discussion_r3322853235


##########
cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/bridge/CassandraBridgeImplementation.java:
##########
@@ -324,6 +333,44 @@ public List<ByteBuffer> encodePartitionKeys(Partitioner 
partitioner, String keys
         return keys.stream().map(key -> buildPartitionKey(table, 
key)).collect(Collectors.toList());
     }
 
+    @Override
+    public void rebuildBloomFilter(@NotNull Partitioner partitioner,
+                                   @NotNull CqlTable cqltable,
+                                   @NotNull SSTable ssTable,
+                                   @NotNull Path directory) throws IOException
+    {
+        String keyspace = cqltable.keyspace();
+        String table = cqltable.table();
+        IPartitioner iPartitioner = getPartitioner(partitioner);
+        Descriptor descriptor = ReaderUtils.constructDescriptor(keyspace, 
table, ssTable);
+        try (IFilter filter = FilterDbUtils.buildBloomFilter(partitioner, 
cqltable, ssTable))
+        {
+            Function<ByteBuffer, Boolean> tracker = bytes -> {
+                DecoratedKey key = iPartitioner.decorateKey(bytes);
+                filter.add(key);
+                return false;
+            };
+
+            try (InputStream primaryIndex = ssTable.openPrimaryIndexStream())
+            {
+                if (primaryIndex == null)
+                {
+                    throw new IOException("Could not read Index.db file");
+                }
+                ReaderUtils.readPrimaryIndex(primaryIndex, tracker);
+            }
+
+            File filterFile = new File(directory.toFile(), 
descriptor.relativeFilenameFor(Component.FILTER));
+            try (FileOutputStream fos = new FileOutputStream(filterFile, 
false);
+                 DataOutputStreamPlus stream = new 
BufferedDataOutputStreamPlus(fos))
+            {
+                BloomFilterSerializer.serialize((BloomFilter) filter, stream);

Review Comment:
   For 5.0, we are using five-zero bridge and [this 
code](https://github.com/apache/cassandra-analytics/pull/211/changes#diff-fea9f2ebb75431ba0f30a7bf99ab10908e1fb730e09fd2b3fbc8b71a6fc6a201R366-R390).
   Adding a condition to skip filter regeneration when `bloom_filter_fp_chance 
== 1.0`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to