Vladislav created TINKERPOP-3164:
------------------------------------
Summary: 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
Elements are lost when sorting by property if the property is missing in a
vertex
Example graph:
```
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()
```
Base sort (without choose step)
```
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]
```
Sort with choose step (Honda CR-V is missing):
```
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]
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)