Skip to content

[common] Reject out-of-range bloom filter items and fpp options - #10108

Open
jackylee-ch wants to merge 1 commit into
apache:masterfrom
jackylee-ch:bloom-filter-option-validation
Open

jackylee-ch wants to merge 1 commit into
apache:masterfrom
jackylee-ch:bloom-filter-option-validation

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Purpose

The bloom filter file index reads items and fpp from table options with no bounds. A percentage-shaped fpp like 10 makes every write fail with a bare NegativeArraySizeException; fpp = 0 overflows the same way; fpp = 1 or negative silently builds a one-byte filter that prunes nothing; a large items overflows the bit-set size.

Reject fpp outside (0, 1) and non-positive items in the writer (the read path never consults them, so existing tables stay readable), and guard the bit-count overflow in BloomFilter64. A bad option now fails at write time naming it. Mirrors #9765 for range-bitmap chunk-size.

Tests

BloomFilterFileIndexTest.testRejectsInvalidOptions: fpp = 10 / 0 / 1.0 / -0.1, items = 0, items = Integer.MAX_VALUE, plus a valid config. Fails on master, passes here.

Written with Claude Code; verification is mine.

The bloom filter file index reads items and fpp from table options with no
bounds. A percentage-shaped fpp such as 10 makes every write fail with a bare
NegativeArraySizeException that names neither the option nor the column; fpp=0
overflows the same way; fpp=1 or a negative value silently builds a one-byte
filter that prunes nothing; and a very large items overflows the bit-set size.

Reject fpp outside (0, 1) and non-positive items at the writer -- the read path
never consults them, so an already-written table stays readable -- and guard the
bit-count overflow in BloomFilter64, so a bad option fails at write time with a
message naming it.
@jackylee-ch
jackylee-ch force-pushed the bloom-filter-option-validation branch from 4ab826d to 916fb0c Compare September 23, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant