You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/15 05:00:14 UTC
[GitHub] [spark] c21 commented on a change in pull request #32907: [SPARK-35757] add bitwise AND operation and functionality for intersecting bloom filters
c21 commented on a change in pull request #32907:
URL: https://github.com/apache/spark/pull/32907#discussion_r651446735
##########
File path: common/sketch/src/main/java/org/apache/spark/util/sketch/BloomFilterImpl.java
##########
@@ -193,14 +193,29 @@ public boolean isCompatible(BloomFilter other) {
@Override
public BloomFilter mergeInPlace(BloomFilter other) throws IncompatibleMergeException {
+ BloomFilterImpl otherImplInstance = checkCompatibilityForMerge(other);
+
+ this.bits.putAll(otherImplInstance.bits);
+ return this;
+ }
+
+ @Override
+ public BloomFilter intersectInPlace(BloomFilter other) throws IncompatibleMergeException {
+ BloomFilterImpl otherImplInstance = checkCompatibilityForMerge(other);
+
+ this.bits.and(otherImplInstance.bits);
+ return this;
+ }
+
+ private BloomFilterImpl checkCompatibilityForMerge(BloomFilter other) throws IncompatibleMergeException {
// Duplicates the logic of `isCompatible` here to provide better error message.
if (other == null) {
throw new IncompatibleMergeException("Cannot merge null bloom filter");
}
if (!(other instanceof BloomFilterImpl)) {
throw new IncompatibleMergeException(
- "Cannot merge bloom filter of class " + other.getClass().getName()
+ "Cannot merge bloom filter of class " + other.getClass().getName()
Review comment:
nit: seem to be unnecessary changed indentation.
##########
File path: common/sketch/src/main/java/org/apache/spark/util/sketch/BloomFilterImpl.java
##########
@@ -212,12 +227,10 @@ public BloomFilter mergeInPlace(BloomFilter other) throws IncompatibleMergeExcep
if (this.numHashFunctions != that.numHashFunctions) {
throw new IncompatibleMergeException(
- "Cannot merge bloom filters with different number of hash functions"
+ "Cannot merge bloom filters with different number of hash functions"
Review comment:
nit: seem to be unnecessary changed indentation.
--
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: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org