feat(storage): optimize ngram bloom index building - #20410
Conversation
🤖 CI Job Analysis (Retry 1)
📊 Summary
❌ NO RETRY NEEDEDAll failures appear to be code/test issues requiring manual fixes. 🔍 Job Details
🤖 AboutAutomated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed). |
sundy-li
left a comment
There was a problem hiding this comment.
阻塞问题(P1):本 PR 当前提交 26d2584 的 CI 失败不是基础设施问题。linux / sqllogic / standalone (standalone, 2c, http) 和 hybrid 都在 tests/sqllogictests/suites/mode/standalone/explain/index/explain_ngram_index.test:98 失败:EXPLAIN ... content LIKE '%月无声%' 预期读取 2 行、扫描 1 个 partition,实际读取 4 行、扫描 2 个 partitions。该变化与 src/query/storages/common/index/src/filters/bloom_filter.rs 中固定 probe 数和 adaptive folding 直接相关。请修复默认 false_positive_rate=0.01 下的 pruning 行为,或确认这是有意的 false-positive tradeoff 并同步更新该回归用例及相关测试;在 required checks 通过前不能合并。
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
String, character-offsetVec, or per-row digestVecHashSetfalse_positive_rateNGRAM index option while keeping the default at0.01Implementation
build()and makesadd_digests()default to repeatedadd_digest()callsfalse_positive_ratevalues in the open interval(0, 1)The configured
bloom_sizeremains the maximum filter size. The target false-positive rate controls probe count and the adaptive folding target. Workloads can explicitly relax it to trade pruning precision for smaller indexes; the benchmark below uses0.8for that specific long-query workload, while the general default remains0.01.Benchmark
The benchmark follows #17852 and uses the six Amazon Reviews Parquet files from 2010 through 2015:
review_bodygram_size = 10bloom_size = 2097152false_positive_rate = 0.8max_threads = 16NGRAM INDEX idx1 (review_body) gram_size = 10 bloom_size = 2097152 false_positive_rate = 0.8COPY
The without-NGRAM baseline uses the same current release binary, source files, 15-column schema, and thread count, but does not declare an NGRAM index. Fuse still writes its normal Bloom indexes in this baseline.
0.8)The ASCII fast path reduced COPY time by another approximately 12.3% compared with the previous implementation result of 336.015 seconds. The total COPY time decreased by approximately 42.1% compared with main.
The current NGRAM build takes approximately 3.96x the without-NGRAM baseline, compared with 6.84x on main. Measured above the 74.448-second baseline, this PR reduces the incremental NGRAM time from 434.468 seconds to 220.211 seconds, approximately 49.3%. The three runs produced 612, 611, and 610 blocks respectively, so small block-layout effects remain in the comparison.
Index and query
The query is the LIKE aggregation from #17852:
0.8)The generated block layouts differ, so the candidate-block counts and index sizes are not treated as direct query-performance comparisons. The current result confirms that folding is applied while the LIKE query continues to prune the large majority of blocks.
Tests
Type of change
AI assistance
This change is