HappenLee opened a new pull request, #70923:
URL: https://github.com/apache/doris/pull/70923
### Background
Runtime Bloom filters reduce join probe work using a filter built from join
keys. Three session variables control the target, minimum and maximum sizes in
bytes. The underlying block Bloom filter allocates a power-of-two directory
with a minimum of 64 bytes.
### What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Bugfix
Problem Summary:
FE accepts invalid sizes, including arbitrary byte counts that can disagree
with the backend allocation. For example, min=max=1000 reaches backend clamping
unchanged before an integral log2 selects a 512-byte directory. Validate these
parameters in FE before they can reach filter planning or dispatch; most of the
diff adds tests. Defaults stay unchanged, while invalid historical values are
rejected when used.
The FE SET entry is exercised programmatically in the new unit test:
```java
VariableMgr.setVar(session, new SetVar(SetType.SESSION,
SessionVariable.RUNTIME_BLOOM_FILTER_SIZE, new StringLiteral("0")));
```
| Baseline | With the fix |
|---|---|
| No exception; the expected rejection assertion fails | Throws
DdlException; the rejection assertion passes |
### Details
- **Frequency:** Always for the invalid FE inputs covered by the unit tests.
The backend allocation discrepancy was traced through source, without a
live-cluster allocation measurement.
- **Root cause:** The three session variables lack size checkers. FE sizing
can round values upward, while raw bounds are forwarded to BE and can replace
the rounded value before allocation.
- **Why existing tests missed it:** Unit tests in `SessionVariablesTest`
cover forwarding and `RuntimeFilterTest` covers plans, without invalid size
inputs. Regression suites such as `query_p0/system/test_runtime_filter` and
`nereids_syntax_p0/runtime_filter` check join results and filter types using
default sizes.
- **Fix:** Share a power-of-two check for sizes from 64 through 1073741824
bytes. Check the complete state before planning, Thrift dispatch and FE
forwarding. Check min/max ordering at consumption so bounds can be set in
either order, and keep JSON/map restoration unchanged.
- **Other paths and branches:** Both FE sizing paths are covered. The same
missing annotation checker is present on branch-2.1, branch-3.1, branch-4.0,
branch-4.1 and branch-4.2; this change targets master only. The introducing PR
was not established from the shallow local history.
- **Behavior change:** Historical invalid settings can still be restored,
but they must be corrected before use. A target outside min/max remains valid
and retains existing clamping behavior.
### Testing
- Local `run-fe-ut.sh` run: 104 tests passed, with no failures, errors or
skips: `SessionVariableRuntimeBloomFilterTest` (9), `SessionVariablesTest`
(26), `VariableMgrTest` (19), and `RuntimeFilterTest` (50).
- The same new test class on the baseline runs 9 tests with 7 assertion
failures and 2 passes; after the fix all 9 pass. Coverage includes SET and
one-shot hints, all supported powers, JSON/map restoration and repair,
forwarding, sizing consumers, dispatch, and both bound-update orders.
### Notes for Reviewers
Local FE packaging uses `build.sh --fe -j48` with UI disabled and its
BE-only Rust dependency preflight temporarily scoped to BE/cloud builds: the
local installation lacks Paimon Rust artifacts. The build script is restored
and excluded from this change. BE allocation and live-cluster execution were
not tested.
### Release note
Runtime Bloom filter size, minimum size and maximum size must be powers of
two from 64 bytes through 1 GiB. FE rejects invalid values when set and rejects
invalid restored settings or inverted bounds before use; defaults are unchanged.
### Check List (For Author)
- Test: Local FE unit tests (104 passed); baseline comparison (7 expected
assertion failures).
- Behavior changed: Yes (see Details)
- Does this need documentation: Yes (follow up in apache/doris-website to
document the supported size range and min/max ordering).
- Pre-submission status: Ready
### AI Disclosure
- Tool: Codex (GPT-6)
- Generated: implementation, unit tests and this description
- Human review: not stated
- Prompts: Requested a minimal FE-only validation fix and a PR after testing.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]