[Bug] Precise union drops repeated keys in the SortShuffle path
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read UnionFilterIterator.java, especially NoRepeatValueIterator.hasNext() and saveElement(), then trace how the reducer handles comparator-equal groups and EOF. Reproduce with 20,000 keys occurring twice and check behavior across flush boundaries and repeated probes. Done means each matching name group emits one representative while preserving the intended representative/value rule.
由索引模型根据 Issue 内容生成。
描述
Bug Type
Logic / missing results in precise union queries.
Environment
Development source reviewed in PR #3395, Java 17. Reproduced with the production iterators and SortShuffle in a standalone JVM; no running Store cluster was used.
Expected and actual behavior
Once UnionFilterIterator has more than 10,000 map entries, it selects the SortShuffle/reducer path. NoRepeatValueIterator omits an entire comparator-equal group when that group occurs more than once, rather than returning one representative.
A probe with 20,000 keys, each read twice returns 0 rows; expected 20,000 rows, one per key. Each occurrence is a newly allocated BackendColumn with identical name/value bytes for that key.
The same query shape should retain each overlapping key once. MapUnionIterator already does so on the alternate small-query path.
Reproduction
- Generate keys as four-byte integer arrays and two occurrences per key, with fresh BackendColumn objects and arrays for every row.
- Populate an IntersectionWrapper from the first pass and call
proc(); all keys in this dataset are repeated candidates. - Construct UnionFilterIterator over an independent second pass, using the production BackendColumn serializer and name comparator.
- Consume normally with
while (iterator.hasNext()) { iterator.next(); count++; }. The observed count is zero.
The 10,000 threshold selects the union's sorting branch. SortShuffle has its own higher physical-file threshold, so this defect can occur before it writes an actual spill file; its file-backed path uses the same reducer.
Cause and focused follow-up
saveElement() preserves repeated candidates for sorting, but NoRepeatValueIterator.hasNext() skips groups where its duplicate counter is positive, including the final group. Fix reduction to emit a representative once for each matching name group, and cover repeated keys across flush boundaries, repeated probes, and EOF. Preserve the intended representative/value rule.
Sources: UnionFilterIterator and reducer, MapUnion alternate query path.
This is independent of the in-memory map-key defect tracked in https://github.com/apache/hugegraph/issues/3396 and predates the changed iterator-state logic in PR #3395. Keep it as a separate correctness fix rather than expanding that PR.
Issue search performed for NoRepeatValueIterator and UnionFilterIterator; no matching existing issue was found.
- 主要语言
- Java
- 星标
- 3.2k
- 派生
- 642
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 100
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/hugegraph 的其他 Issue
-
[Bug] PD task REST: balanceLeaders throws a bare HTTP 500 during the balance-shard window, and task responses cannot be told apart from a no-op or a follower answer可能已有人在做 @pallavithegod 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
apache/hugegraph#3231 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Bug] In-memory union and intersection fail to combine equal scan rows可能已有人在做 @vaidikgarg-bit 今天认领。 未关闭bug
难度 4/5 1-2 天 新手友好度 55/100
apache/hugegraph#3396 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
-
[Bug] PD TTL cleanup deletes the marker-shaped name instead of the expired key, so expired values stay in the store until read可能已有人在做 @bitflicker64 于 3 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
dev/release: verify-release-candidate.sh runs 0 Java tests with Debian's Maven可能已有人在做 @kou 今天认领。 未关闭Type: bug
难度 2/5 1-3 小时 新手友好度 72/100
apache/arrow-adbc#4947 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
lysine-dev/okhttp#9814 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
checkstyle/checkstyle#22153 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复