order().by(key) returns the elements without the key, which TinkerPop leaves out
I maintainer di solito rispondono entro 2 giorni
Una pull request collegata è già stata integrata.
- #5108 di @porunov — integrata
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 15/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 5.9k
- Fork
- 1.2k
- Merge medio
- 2g 6h
- PR unite (30g)
- 77
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JanusGraph/janusgraph
-
Add Janus Studio to the Visualization sectionForse già presa @Zorabi l’ha presa 67 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
JanusGraph/janusgraph#4943 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
JanusGraph/janusgraph#1578 ·
I maintainer di solito rispondono entro 2 giorni
-
kind/bug/possible
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
JanusGraph/janusgraph#5113 ·
I maintainer di solito rispondono entro 2 giorni
-
kind/bug/possible
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
JanusGraph/janusgraph#5051 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
A vertex looked up by id costs up to three backend reads: its existence, its properties and its labelForse già presa @porunov l’ha presa 22 giorni fa. Apertakind/performance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
JanusGraph/janusgraph#5016 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di JanusGraph/janusgraph
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
strimzi/strimzi-kafka-operator#13328 · 1 commento · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
GoogleContainerTools/jib#4538 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
OpenLiberty/ci.maven#2137 ·
I maintainer di solito rispondono entro 1 giorno
-
Payer adjustment can exceed the balance left after copay and deductible, so claim payments add up to more than the chargeForse già presa @DG47 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
synthetichealth/synthea#1772 ·
I maintainer di solito rispondono entro 13 giorni
-
bug dependencies
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100