Undirected relationship patterns match outgoing edges only

オープン
#170 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
databases

調査の方向性

Start in datafusion_planner/join_ops.rs and trace the RelationshipDirection::Undirected cases named in the issue. Read test_undirected_join_qualified_keys and compare its key-name assertions with the Alice → Bob reproduction. Done when the query returns Alice from Bob’s undirected match and tests cover both edge directions and self-loops.

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

説明

An undirected relationship pattern, (a)-[:R]-(b), is planned as outgoing only, so it misses every edge that points at a.

Repro (on main, e260cf6): one edge, Alice → Bob.

// Person(id, name) = [(1, "Alice"), (2, "Bob")]; KNOWS(src, dst) = [(1, 2)]
let config = GraphConfig::builder()
    .with_node_label("Person", "id")
    .with_relationship("KNOWS", "src", "dst")
    .build()?;
// MATCH (a:Person)-[:KNOWS]-(b:Person) WHERE a.name = 'Alice' RETURN b.name  -> ["Bob"]  (ok)
// MATCH (a:Person)-[:KNOWS]-(b:Person) WHERE a.name = 'Bob'   RETURN b.name  -> []       (expected ["Alice"])

Cause. In datafusion_planner/join_ops.rs, RelationshipDirection::Undirected picks the same keys as Outgoing in each match (lines 101, 146, 222, 249, 261): source joins source_id_field, target joins target_id_field. test_undirected_join_qualified_keys checks the qualified key names, not that both directions are matched.

A possible fix. Plan an undirected expand as the union of the outgoing and the incoming expand, each with its own keys, deduplicating only a self-loop that both would return. A single join on (a = src AND b = dst) OR (a = dst AND b = src) also works, but DataFusion then cannot use a hash join on it. Variable-length paths built from the unrolled expands would pick this up as well. Happy to open a PR along those lines if that approach suits you.

主要言語
Rust
スター
189
フォーク
40
平均マージ
16分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

lance-format/lance-graph のほかの issue

lance-format/lance-graph の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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