graphprotocol / graphprotocol/graph-node

[Bug] Ordering by children can be nondeterministic

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

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

bug Stale
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

Bug report

With a schema like

type Parent @entity {
  id: Bytes!
 child: Child!
}

type Child @entity {
  id: Bytes!
}

the result for a query like

query { parents(orderBy: child__id) } { id } }

is nondeterministic if multiple parents point to the same child. To make this entirely clear, assume there is only one instance of Child. The SQL query that gets generated is roughly

select * 
  from parent p 
    left join child c on (c.id = p.child) 
where ...
order by c.id

But when multiple rows in p have the same p.child, that ordering is ill-defined. We'd need to change that to order by c.id, p.id to make that deterministic.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

Issue にはファイル名もテスト名も記載されていません。複数の親が 1 つの子を指す GraphQL クエリを再現し、生成された SQL の順序を調べ、child__id による順序付けを担当するクエリ生成のエントリーポイントを追跡してください。結合された子の値が同順位の場合でも、要求された順序を維持したまま同等の結果が決定的になることが完了条件です。

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

評価

技術スタック
graphql, rust, sql
領域
backend-api-design, databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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