Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] Precise union drops repeated keys in the SortShuffle path

未关闭
#3,397 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
databases

调研方向

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
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
  1. Generate keys as four-byte integer arrays and two occurrences per key, with fresh BackendColumn objects and arrays for every row.
  2. Populate an IntersectionWrapper from the first pass and call proc(); all keys in this dataset are repeated candidates.
  3. Construct UnionFilterIterator over an independent second pass, using the production BackendColumn serializer and name comparator.
  4. 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/hugegraph 的其他 Issue

查看 apache/hugegraph 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。