order().by(key) returns the elements without the key, which TinkerPop leaves out
メンテナーはふだん 2 日以内に返信
関連するプルリクエストがすでにマージされています。
- #5108 @porunov による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 15/100
調査の方向性
Start by running the Groovy reproduction against inmemory storage and comparing it with TinkerGraph. The fold logic is in HasStepFolder.foldInOrder and validJanusGraphOrder, which feed JanusGraphStep, GraphCentricQueryBuilder.orderBy and OrderList, and the vertex-step path through BaseVertexCentricQueryBuilder.orderBy and BasicVertexCentricQueryBuilder.loadRelationsFromCache. Done means the counts and orders match TinkerGraph for each case, and the AssertionError and IllegalArgumentException no longer occur. PR #5108 already addresses this, so coordinate with it first.
索引モデルが issue の本文から書いたものです。
説明
JanusGraph folds a traversal's order().by(key) into its query, and the query returns the elements which have no value of the key as well, after the others. TinkerPop leaves such an element out: a by() modulator which yields no value filters the traverser, so TinkerGraph returns only the elements which have the key.
Reproduction (inmemory storage; the same with a mixed index on kind and name, on Lucene or Elasticsearch):
g.addV().property('kind', 'p').property('name', 'c').iterate()
g.addV().property('kind', 'p').property('name', 'a').iterate()
g.addV().property('kind', 'p').iterate()
g.addV().property('kind', 'p').property('name', 'b').iterate()
g.V().has('kind', 'p').order().by('name').count() // TinkerGraph: 3, JanusGraph: 4
g.V().has('kind', 'p').order().by('name') // JanusGraph: a, b, c, then the vertex without a name
The same happens wherever JanusGraph folds the order in:
- in a query which a mixed index sorts, one whose results a composite index gives and JanusGraph sorts, and one which no index answers;
- for the vertices and edges which a transaction added or changed;
- in an order of the edges or properties of a vertex, such as
g.V(v).local(outE('link').order().by('weight').limit(2)). Descending, the edges without a weight come first there.
Related problems in the same code
order().by('name', shuffle)throws anAssertionErrorfromOrder.convert:HasStepFolder.validJanusGraphOrderlets the order through.- Of several
order()steps in a row, such asorder().by('age').order().by('name'), JanusGraph drops all but the last. So the elements without anagestay, and the ties ofnamearen't ordered byage, as TinkerPop's sorts, which keep the order of ties, order them. An earlier order by a traversal, such asorder().by(values('age').is(gt(2))), is dropped too. g.V(v).local(outE('link').order().by('weight').by('uid'))throwsIllegalArgumentException: Only a single sort order is supported on vertex queries.- With
query.batch.enabled, which is the default,g.V(v).local(outE('link').order().by('weight').limit(2))returns the edges in the order in which the storage backend holds them, rather than byweight, where no vertex-centric index sorts the label's edges byweight. An orderedJanusGraphMultiVertexQuery, such astx.multiQuery(v).labels('link').orderBy('weight', asc).edges(), returns them in that order too. - With the deprecated
ProductiveByStrategy, which makesby('name')yield null where a vertex has no name, TinkerPop places those vertices first when ascending, while JanusGraph folds the order in and places them last.
Cause
HasStepFolder.foldInOrderfolds the keys of the order into the step.JanusGraphSteppasses them toGraphCentricQueryBuilder.orderBy, whose query keeps an element without a value and places it last (OrderList).JanusGraphVertexStepandJanusGraphPropertiesStepdo the same for a vertex's relations, whichRelationComparatorplaces last when ascending and first when descending.validJanusGraphOrdertakes anyOrder,shuffleincluded, and aby(key)whoseValueTraversalhas a bypass traversal.foldInOrderremoves everyorder()step before the last, whatever its modulators.BaseVertexCentricQueryBuilder.orderBytakes one key, whilefoldInOrderfolds every key of the order into a vertex step.BasicVertexCentricQueryBuilder.loadRelationsFromCachereturns the relations which a multi-query loaded as they are when each subquery is cached and fitted, whether or not the backend sorts it by the query's order.
- 主要言語
- Java
- スター
- 5.9k
- フォーク
- 1.2k
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 77
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JanusGraph/janusgraph のほかの issue
-
Add Janus Studio to the Visualization section対応中かも @Zorabi が 68 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
JanusGraph/janusgraph#4943 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
JanusGraph/janusgraph#1578 ·
メンテナーはふだん 2 日以内に返信
-
kind/bug/possible
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
JanusGraph/janusgraph#5113 ·
メンテナーはふだん 2 日以内に返信
-
kind/bug/possible
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
JanusGraph/janusgraph#5051 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
A vertex looked up by id costs up to three backend reads: its existence, its properties and its label対応中かも @porunov が 24 日前に担当しました。 オープンkind/performance
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
JanusGraph/janusgraph#5016 ·
メンテナーはふだん 2 日以内に返信
JanusGraph/janusgraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
OpenAPITools/openapi-generator#25454 ·
メンテナーはふだん 1 日以内に返信
-
Component - Build
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
navikt/mock-oauth2-server#1149 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oracle/graalvm-reachability-metadata#11318 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Stirling-Tools/Stirling-PDF#8709 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信