You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/07/19 15:42:00 UTC

[iotdb] branch rel/0.12 updated: [To rel/0.12][IOTDB-3858] IndexOutOfBoundsException: bitIndex < 0 (#6722)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new b1c224900f [To rel/0.12][IOTDB-3858] IndexOutOfBoundsException: bitIndex < 0 (#6722)
b1c224900f is described below

commit b1c224900f290921a33738cf4bab864b209ec0b5
Author: Chen YZ <43...@users.noreply.github.com>
AuthorDate: Tue Jul 19 23:41:54 2022 +0800

    [To rel/0.12][IOTDB-3858] IndexOutOfBoundsException: bitIndex < 0 (#6722)
---
 .../src/main/java/org/apache/iotdb/tsfile/utils/BloomFilter.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BloomFilter.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BloomFilter.java
index 74c54db66a..6ab59d0c79 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BloomFilter.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BloomFilter.java
@@ -138,7 +138,12 @@ public class BloomFilter {
     }
 
     public int hash(String value) {
-      return Math.abs(Murmur128Hash.hash(value, seed)) % cap;
+      int res = Murmur128Hash.hash(value, seed);
+      if (res == Integer.MIN_VALUE) {
+        res = 0;
+      }
+
+      return Math.abs(res) % cap;
     }
   }
 }