mrhhsg opened a new pull request, #71165:
URL: https://github.com/apache/doris/pull/71165
### What problem does this PR solve?
Issue Number: None
Related PR: #66455
Cherry-picked from #66455 (master) to branch-4.2.
Problem Summary:
IN metadata pruning previously converted native `HybridSet` values through
literal and `Field` materialization. This duplicated the IN set for zonemap
pruning and constructed owning `Field` values for Bloom candidates.
This backport:
- Adds typed min/max, exact range membership, and synchronous native-byte
callbacks to `HybridSet`. Zonemap snapshots retain only two owning non-NaN
bounds and a NaN flag, rather than a `Field` copy of every candidate.
- Reuses the original typed set for exact zonemap checks and dictionary
lookups, and probes Bloom filters with native bytes and early exit. String hash
lookups preserve explicit lengths, including embedded NUL bytes.
- Reuses prepared immutable bounds across direct-IN expression clones,
preserving conservative handling of NULL, NaN, signed zero, unsupported types,
and reader-schema mismatches.
- Adds mutable BE configuration `in_zonemap_point_check_threshold` (default
`8192`), replacing the hard-coded limit of `64`. Larger sets retain
conservative min/max-only pruning. The change affects pruning cost and
selectivity, not SQL results.
- Limits the expression-zonemap timer to scans that actually have
pushed-down expressions.
Branch-4.2 adaptations:
- Retains this branch's existing VARBINARY guard and fixed/dynamic
containers; does not introduce master-only bitset containers.
- Preserves existing benchmark registrations while adding the HybridSet
benchmark, and updates the nullable-selection benchmark optimization barriers.
- Uses the branch's existing `RowDescriptor` constructor with explicit tuple
nullability. Adjusts the large-IN regression to `8193` unique values so it
still exercises the range-only path with the new default threshold, without
relaxing its assertions.
### Release note
Reduce IN metadata-pruning materialization overhead. The exact-check limit
for IN zonemap pruning is now configurable with
`in_zonemap_point_check_threshold` (default `8192`). SQL result semantics are
unchanged.
### Check List (For Author)
- Test
- [x] Unit Test: **123/123 tests passed under ASAN**, across 7 suites:
```bash
./run-be-ut.sh --run
--filter='ExprZonemapFilterTest.*:HybridSetTest.*:RuntimeFilterMergerTest.*:RuntimeFilterProducerTest.*:FileScannerV2Test.ConditionCacheDigestIncludesRuntimeFilterPayload:ParquetBloomFilterPruningTest.*:NewOrcReaderTest.SargDirectIn*'
-j 48
```
- [x] Regression test: each of the following passed **1/1 suite**, with
no skips, using an isolated single-BE native OLAP cluster:
```bash
./run-regression-test.sh --conf <local-regression-conf> --run -d
query_p0/expr_zonemap -s test_expr_zonemap_pruning
./run-regression-test.sh --conf <local-regression-conf> --run -d
query_p1/expr_zonemap -s test_expr_zonemap_pruning_p1
./run-regression-test.sh --conf <local-regression-conf> --run -d
nereids_p0/runtime_filter -s set_operator_in_filter
```
- [x] Manual test:
- Release BE build: `./build.sh --be -j 32`.
- Release BE/FE/benchmark build: `./build.sh --be --fe --benchmark -j
32`; integrated Maven Checkstyle reported zero violations.
- Benchmark smoke: **276/276 cases** completed without errors (68
HybridSet/StringSet, 200 Parquet nullable-selection, 8 FileScannerExpr), using
`--benchmark_min_time=0.001s`. This checks executability only; no performance
speedup is claimed.
- clang-format 16 check of all 18 changed C++ files and `git diff
--check` passed.
Validation scope: SQL regression ran with Java support disabled because Java
BE extensions were not built. Java UDFs and Java-based external-catalog
end-to-end paths were not tested. Native ORC/Parquet pruning paths were covered
by the focused ASAN tests. Standalone clang-tidy was not run.
- Behavior changed:
- [ ] No.
- [x] Yes. IN zonemap exact-check selection is configurable and defaults
to 8192 values instead of 64; SQL result semantics are unchanged.
- Does this need documentation?
- [x] No. Backport of #66455.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]