Undirected relationship patterns match outgoing edges only

Aperta
#170 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
189
Fork
40
Merge medio
16m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lance-format/lance-graph

Tutte le issue di lance-format/lance-graph

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.