Skip to content

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

Merged
JingsongLi merged 1 commit into
apache:masterfrom
jackylee-ch:bloom-filter-option-validation
Sep 24, 2026
Merged

JingsongLi merged 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

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reported failure has an end-to-end impact: malformed Bloom filter options currently fail during writes with an opaque allocation error or silently produce ineffective indexes. This change rejects invalid fpp and non-positive items at writer construction and checks the computed bit count before allocation. It leaves deserialization of existing index files untouched. I checked the numeric boundaries, including NaN/infinity behavior at the writer guard and the final byte-alignment arithmetic; I found no actionable regression.

Local verification: BloomFilterFileIndexTest (3 tests) and BloomFilter64Test (1 test) passed, including the new invalid-option cases and existing write/read behavior. git diff --check passed.

Requirement fit: SUPPORTED. Implementation: CLEAN.

@JingsongLi
JingsongLi merged commit 4df3992 into apache:master Sep 24, 2026
18 checks passed
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.

2 participants