[Store] LIMIT_DEDUP on NO_SCAN with loadPropertyFromIndex compares BaseVertex by reference

オープン 初心者向け
#3,443 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
databases

調査の方向性

MapLimitIterator と、transElement が scanIndexToBaseElement を wrap している BusinessHandlerImpl.scanIndex 内のその呼び出しを読む。MapLimitIterator に key extractor を追加し、そのパスで BaseElement::id を渡す。同じ id を持つ頂点が重複排除され、既存の store テストが通ると完了。

索引モデルが issue の本文から書いたものです。

説明

In BusinessHandlerImpl.scanIndex(graph, params, dedupOption, transElement, filterTTL), the transElement branch wraps scanIndexToBaseElement in MapLimitIterator<BaseElement> for LIMIT_DEDUP. MapLimitIterator dedups with a hash set of the elements themselves. BaseEdge defines equals/hashCode on id(), but BaseVertex and BaseElement define neither, so two vertex objects with the same id both get through. DEDUP and PRECISE_DEDUP on the same branch already hash on id().asBytes().

This can't be hit today. BinaryElementSerializer.index2Element throws NotImplementedException, and StoreQueryParam always sends loadPropertyFromIndex=false. It will show up once index2Element is implemented. Search indexes, secondary indexes on collection properties and joint secondary indexes all write several entries per element, and a scan that covers more than one of them returns the same vertex once per entry.

Suggested fix: give MapLimitIterator a key extractor and pass BaseElement::id on this path. Adding equals/hashCode to BaseVertex in hugegraph-struct would also work, but it changes equality for every collection that holds vertices.

主要言語
Java
スター
3.2k
フォーク
645
平均マージ
1日 2時間
マージ済み PR(30日)
123

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/hugegraph のほかの issue

apache/hugegraph の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。