[ 
https://issues.apache.org/jira/browse/TINKERPOP-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladislav updated TINKERPOP-3164:
---------------------------------
    Description: 
Elements are lost when sorting by property (after choose step) if the property 
is missing in a vertex

Example graph:
{code:java}
gremlin> graph.traversal().addV("Car").property("brand", 
"Ford").property("model", "F-150").property("type", "TRUCK").property("weight", 
5000).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Nissan").property("model", "Frontier").property("type", 
"TRUCK").property("weight", 4500).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Audi").property("model", "Q8").property("type", 
"CROSSOVER").property("weight", 4900).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Honda").property("model", "CR-V").property("type", "CROSSOVER").iterate() 
{code}
Base sort (without choose step)
{code:java}
gremlin> 
graph.traversal().V().hasLabel("Car").order().by("brand").by("weight").elementMap()
15:42:10 WARN  
org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
requires iterating over all vertices [[~label = Car]]. For better performance, 
use indexes
==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
==>[weight:5000,model:F-150,type:TRUCK,brand:Ford,id:4136,label:Car]
==>[model:CR-V,type:CROSSOVER,brand:Honda,id:4328,label:Car]
==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] {code}
Sort with choose step (Honda CR-V is missing):
{code:java}
gremlin> 
graph.traversal().V().hasLabel("Car").choose(__.values("type")).option("TRUCK", 
__.has("weight", P.lte(4500))).option("CROSSOVER", 
__.identity()).order().by("brand").by("weight").elementMap()
15:43:53 WARN  
org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
requires iterating over all vertices [[~label = Car]]. For better performance, 
use indexes
==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] {code}

  was:
Elements are lost when sorting by property if the property is missing in a 
vertex

Example graph:
{code:java}
gremlin> graph.traversal().addV("Car").property("brand", 
"Ford").property("model", "F-150").property("type", "TRUCK").property("weight", 
5000).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Nissan").property("model", "Frontier").property("type", 
"TRUCK").property("weight", 4500).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Audi").property("model", "Q8").property("type", 
"CROSSOVER").property("weight", 4900).iterate()
gremlin> graph.traversal().addV("Car").property("brand", 
"Honda").property("model", "CR-V").property("type", "CROSSOVER").iterate() 
{code}
Base sort (without choose step)
{code:java}
gremlin> 
graph.traversal().V().hasLabel("Car").order().by("brand").by("weight").elementMap()
15:42:10 WARN  
org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
requires iterating over all vertices [[~label = Car]]. For better performance, 
use indexes
==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
==>[weight:5000,model:F-150,type:TRUCK,brand:Ford,id:4136,label:Car]
==>[model:CR-V,type:CROSSOVER,brand:Honda,id:4328,label:Car]
==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] {code}
Sort with choose step (Honda CR-V is missing):
{code:java}
gremlin> 
graph.traversal().V().hasLabel("Car").choose(__.values("type")).option("TRUCK", 
__.has("weight", P.lte(4500))).option("CROSSOVER", 
__.identity()).order().by("brand").by("weight").elementMap()
15:43:53 WARN  
org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
requires iterating over all vertices [[~label = Car]]. For better performance, 
use indexes
==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] {code}


> Sorting doesn't work after the 'choose' step (if the property doesn't exist)
> ----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-3164
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3164
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.7.2
>            Reporter: Vladislav
>            Priority: Major
>
> Elements are lost when sorting by property (after choose step) if the 
> property is missing in a vertex
> Example graph:
> {code:java}
> gremlin> graph.traversal().addV("Car").property("brand", 
> "Ford").property("model", "F-150").property("type", 
> "TRUCK").property("weight", 5000).iterate()
> gremlin> graph.traversal().addV("Car").property("brand", 
> "Nissan").property("model", "Frontier").property("type", 
> "TRUCK").property("weight", 4500).iterate()
> gremlin> graph.traversal().addV("Car").property("brand", 
> "Audi").property("model", "Q8").property("type", 
> "CROSSOVER").property("weight", 4900).iterate()
> gremlin> graph.traversal().addV("Car").property("brand", 
> "Honda").property("model", "CR-V").property("type", "CROSSOVER").iterate() 
> {code}
> Base sort (without choose step)
> {code:java}
> gremlin> 
> graph.traversal().V().hasLabel("Car").order().by("brand").by("weight").elementMap()
> 15:42:10 WARN  
> org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
> requires iterating over all vertices [[~label = Car]]. For better 
> performance, use indexes
> ==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
> ==>[weight:5000,model:F-150,type:TRUCK,brand:Ford,id:4136,label:Car]
> ==>[model:CR-V,type:CROSSOVER,brand:Honda,id:4328,label:Car]
> ==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] 
> {code}
> Sort with choose step (Honda CR-V is missing):
> {code:java}
> gremlin> 
> graph.traversal().V().hasLabel("Car").choose(__.values("type")).option("TRUCK",
>  __.has("weight", P.lte(4500))).option("CROSSOVER", 
> __.identity()).order().by("brand").by("weight").elementMap()
> 15:43:53 WARN  
> org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query 
> requires iterating over all vertices [[~label = Car]]. For better 
> performance, use indexes
> ==>[weight:4900,model:Q8,type:CROSSOVER,brand:Audi,id:8408,label:Car]
> ==>[weight:4500,model:Frontier,type:TRUCK,brand:Nissan,id:4312,label:Car] 
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to