Undirected relationship patterns match outgoing edges only

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

还没有人认领这个 Issue。

评估

难度
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 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

lance-format/lance-graph 的其他 Issue

查看 lance-format/lance-graph 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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