Closed Yicheng-Wang closed 3 years ago
Do u mean:
g.V().order().by(property, desc)
or V.id().xx
is OK in HugeGraph, but g.V().order().by(desc)
is not supported? (if yes, could u check if the server's log print any stack of exception? or open debug mode)Will find the reason soon
Do u means:
g.V().order().by(property, desc)
orV.id().xx
is OK in HugeGraph, butg.V().order().by(desc)
is not supported? (if yes, could u check if the server's log print any stack of exception? or open debug mode)- Does JanusGraph can support both of them? refer to the TinkerPop order() step, seems search with property/value is the official case?
Will find the reason soon
2021-08-19 10:01:48 20643 [gremlin-server-exec-2] [WARN ] org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler [] - Invalid request - responding with 500 Internal Server Error and com.baidu.hugegraph.structure.HugeVertex cannot be cast to java.lang.Comparable
java.lang.ClassCastException: com.baidu.hugegraph.structure.HugeVertex cannot be cast to java.lang.Comparable
at org.apache.tinkerpop.gremlin.process.traversal.Order$4.compare(Order.java:103) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.util.function.MultiComparator.compare(MultiComparator.java:57) ~[gremlin-core-3.4.3.jar:3.4.3]
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[?:1.8.0_292]
at java.util.TimSort.sort(TimSort.java:220) ~[?:1.8.0_292]
at java.util.Arrays.sort(Arrays.java:1512) ~[?:1.8.0_292]
at java.util.ArrayList.sort(ArrayList.java:1464) ~[?:1.8.0_292]
at java.util.Collections.sort(Collections.java:177) ~[?:1.8.0_292]
at org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet.sort(TraverserSet.java:151) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep.barrierConsumer(OrderGlobalStep.java:68) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.process.traversal.step.util.CollectingBarrierStep.processNextStart(CollectingBarrierStep.java:113) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:197) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.fill(IteratorUtils.java:62) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.list(IteratorUtils.java:85) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.asList(IteratorUtils.java:382) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.lambda$channelRead$1(HttpGremlinEndpointHandler.java:245) ~[gremlin-server-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.util.function.FunctionUtils.lambda$wrapFunction$0(FunctionUtils.java:36) ~[gremlin-core-3.4.3.jar:3.4.3]
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:272) ~[gremlin-groovy-3.4.3.jar:3.4.3]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_292]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_292]
at com.baidu.hugegraph.auth.HugeGraphAuthProxy$ContextTask.run(HugeGraphAuthProxy.java:1537) [hugegraph-api-0.11.2.jar:0.58.0.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
The reason for supporting the g.V().order().by(desc)
, we need implement a general comparator for it (lack it now)
U can use g.V().id().order().by()
or g.V().order().by(T.id, desc)
now
The reason for supporting the
g.V().order().by(desc)
, we need implement a general comparator for it (lack it now)U can use
g.V().id().order().by()
org.V().order().by(T.id, desc)
now
Fair enough, thank you for the response~
Problem Type (问题类型)
gremlin (结果不合预期)
Before submit
Environment (环境信息)
Your Question (问题描述)
Expected behavior
We expecte get the vertexes/edges ordered by their ID using gremlin order query without specified property like
"g.V()/E().order().by(asc/desc)"
in HugeGraph, as we can get the result by the same query in JanusGraph.Actual behavior
An exception was thrown.
Example to reproduce
We could successfully run the order() step with specified property in Hugegraph, like using
"g.V().id().order().by(asc)"
to get vertexes ordered by vertex ID. We bring up the issue for we are wondering whether query without specified property, like"g.V()/E().order().by(asc/desc)"
, is grammatically correct or not, as we find it could be accepted in JanusGraph while get exception above in HugeGraph.Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response