Skip to content

Navigation Menu

Sign in
Sign up

Document the maximum size of a BloomFilter (fixes #2366) #8571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
UditDewan wants to merge 1 commit into google:master
base: master
Choose a base branch
Loading
from UditDewan:document-bloomfilter-size-limit
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions android/guava/src/com/google/common/hash/BloomFilter.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,19 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions}
* and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small
* {@code fpp} will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @param fpp the desired false positive probability (must be positive and less than 1.0)
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 *
* Integer.MAX_VALUE}
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Funnel<? super T> funnel, int expectedInsertions, double fpp) {
Expand All @@ -444,11 +452,19 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions}
* and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small
* {@code fpp} will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @param fpp the desired false positive probability (must be positive and less than 1.0)
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 *
* Integer.MAX_VALUE}
* @since 19.0
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Expand Down Expand Up @@ -497,10 +513,16 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at
* roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE}
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Funnel<? super T> funnel, int expectedInsertions) {
Expand All @@ -521,10 +543,16 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at
* roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE}
* @since 19.0
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Expand Down
28 changes: 28 additions & 0 deletions guava/src/com/google/common/hash/BloomFilter.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,19 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions}
* and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small
* {@code fpp} will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @param fpp the desired false positive probability (must be positive and less than 1.0)
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 *
* Integer.MAX_VALUE}
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Funnel<? super T> funnel, int expectedInsertions, double fpp) {
Expand All @@ -454,11 +462,19 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions}
* and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small
* {@code fpp} will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @param fpp the desired false positive probability (must be positive and less than 1.0)
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 *
* Integer.MAX_VALUE}
* @since 19.0
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Expand Down Expand Up @@ -507,10 +523,16 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at
* roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE}
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Funnel<? super T> funnel, int expectedInsertions) {
Expand All @@ -531,10 +553,16 @@ public int hashCode() {
* ensuring proper serialization and deserialization, which is important since {@link #equals}
* also relies on object identity of funnels.
*
* <p>Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code
* 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at
* roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit.
*
* @param funnel the funnel of T's that the constructed {@code BloomFilter} will use
* @param expectedInsertions the number of expected insertions to the constructed {@code
* BloomFilter}; must be positive
* @return a {@code BloomFilter}
* @throws IllegalArgumentException if the number of bits required to hold {@code
* expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE}
* @since 19.0
*/
public static <T extends @Nullable Object> BloomFilter<T> create(
Expand Down

AltStyle によって変換されたページ (->オリジナル) /