github-actions[bot] commented on code in PR #67538: URL: https://github.com/apache/doris/pull/67538#discussion_r4001553413
########## regression-test/suites/inverted_index_p0/gram/test_gram_stop_gram.groovy: ########## @@ -0,0 +1,245 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.apache.doris.regression.action.ProfileAction + +import java.util.regex.Pattern + +// stop-gram end to end: an index built with the posting lists of very common grams dropped +// must still answer LIKE/REGEXP exactly, and must actually have dropped them. +// +// A dropped gram matches every document, so it can only ever widen the candidate set the +// index proposes, and the predicate is re-evaluated on those candidates. The observable +// contract is therefore equality: every pattern must return exactly what a full scan +// returns. The rows below are built so that the common grams really are common -- a shared +// prefix on every row -- while the patterns being searched for are rare, which is the shape +// where dropping matters. +// +// There is no switch to turn the feature off, so the control arm is the row floor instead: +// a segment under kHighDfDigestDivisor (2000) rows never drops a posting. The same 4000 rows +// are therefore loaded twice, once as a single segment (dropping active, threshold +// 4000 / 2000 * 3 = df 6) and once as five segments of 800 (dropping inactive, every +// posting kept). The two tables must agree on every answer, and the single-segment index +// must be much smaller -- that difference is the dropped postings, and it also pins that +// the floor holds. +suite("test_gram_stop_gram", "p0") { Review Comment: [P2] Isolate and restore this cluster-wide BE config change. This `p0` suite runs in the normal parallel pool, but line 232 sets `gram_index_max_candidate_ratio_bp=0` on every backend, so overlapping suites can observe a disabled fallback gate; the `finally` block then writes `15` rather than each backend prior value, leaving non-default environments changed for the remainder of the run (until another update or BE restart). Please either remove this ineffective ratio phase (the persisted digest budget wins for this 4,000-row segment), or mark the suite `nonConcurrent`, capture each BE original value, and restore those values in `finally`. ########## be/benchmark/README_gram_extractor.md: ########## @@ -0,0 +1,55 @@ +# Gram extraction benchmark + +`GramExtraction` measures the real `GramExtractor::extract` implementation, including +ASCII folding, boundary selection, per-row deduplication and allocations. It is not a +benchmark of complete token streams, index construction, or SQL queries. + +## Build and run + +Set `BUILD_TYPE=RELEASE` in the local `custom_env.sh` for this performance build, then +use the standard build entry point: + +```bash +./build.sh --benchmark -j "$(nproc)" +./output/be/lib/benchmark_test \ + --benchmark_filter='GramExtraction/' \ + --benchmark_min_time=0.3s \ + --benchmark_repetitions=7 \ + --benchmark_out=gram-extraction.json \ + --benchmark_out_format=json +``` + +On Linux, make the build's `libjvm.so` discoverable through `LD_LIBRARY_PATH` if +needed. Keep correctness tests in the normal ASAN build; do not compare an ASAN +timing with a RELEASE timing. + +## Matrix + +| Argument | Values | +| --- | --- | +| `bytes` | 128, 4096, 65536, 1048576 | +| `sparse` | 0: dense; 1: sparse | +| `lower_case` | 0: preserve ASCII case; 1: fold ASCII case | +| `corpus` | 0: deterministic diverse ASCII; 1: repeated ASCII log; 2: mixed UTF-8 log | +| `fresh` | 1: construct/destroy extractor and output vector per row; 0: reuse both | + +Other parameters use `GramScheme` defaults: minimum length 3, maximum length 16, Review Comment: [P2] Align this benchmark contract with the code it measures. `GramExtraction` default-constructs `GramScheme`, whose current `max_len` is 4, not 16, and the changed SNII writer now reuses one `GramTokenizer` and its buffers across rows, so `fresh=1` no longer matches the production writer lifetime. Results reported as “default” or “writer-matching” can therefore support the wrong performance conclusion. Please update the stale defaults/comments and label `fresh=1` as synthetic allocation sensitivity (or explicitly set 16 and add a writer-level production-lifetime case). -- 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]
