JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.34k stars 1.18k forks source link

graph variable values do not support list #669

Open kontact-chan opened 7 years ago

kontact-chan commented 7 years ago

Tested : janus 0.2.0 Documented by tinkerpop: tinkerpop doc doc section 'Graph Variables'

gremlin> graph ==>standardjanusgraph[cql:[127.0.0.1]] gremlin> graph.variables().set('systemAdmins',['stephen','peter','pavel']) Graph variable value [[stephen, peter, pavel]] is of type class java.util.ArrayList is not supported Type ':help' or ':h' for help. Display stack trace? [yN]y java.lang.UnsupportedOperationException: Graph variable value [[stephen, peter, pavel]] is of type class java.util.ArrayList is not supported at org.apache.tinkerpop.gremlin.structure.Graph$Variables$Exceptions.dataTypeOfVariableValueNotSupported(Graph.java:399) at org.apache.tinkerpop.gremlin.structure.Graph$Variables$Exceptions.dataTypeOfVariableValueNotSupported(Graph.java:395) at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration.object2StaticBuffer(KCVSConfiguration.java:255) at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration.set(KCVSConfiguration.java:140) at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration.set(KCVSConfiguration.java:130) at org.janusgraph.graphdb.tinkerpop.JanusGraphVariables.set(JanusGraphVariables.java:56) at org.apache.tinkerpop.gremlin.structure.Graph$Variables$set.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at groovysh_evaluate.run(groovysh_evaluate:3) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232) at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:70) at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:191) at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.super$3$execute(GremlinGroovysh.groovy) at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132) at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:72) at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122) at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy) at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124) at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:83) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232) at org.apache.tinkerpop.gremlin.console.Console.(Console.groovy:166) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232) at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:478) gremlin>

robertdale commented 7 years ago

JanusGraph Cassandra supports:

gremlin> graph.features()
==>FEATURES
...
> VariableFeatures
>-- Variables: true
>-- BooleanValues: true
>-- ByteValues: true
>-- DoubleValues: true
>-- FloatValues: true
>-- IntegerValues: true
>-- LongValues: true
>-- BooleanArrayValues: true
>-- ByteArrayValues: true
>-- DoubleArrayValues: true
>-- FloatArrayValues: true
>-- IntegerArrayValues: true
>-- StringArrayValues: true
>-- LongArrayValues: true
>-- StringValues: true
>-- MapValues: true
...

Since String[] is supported, you could do this in the console: graph.variables().set('systemAdmins',['stephen','peter','pavel'] as String[])

kontact-chan commented 7 years ago

explicit cast works only for String. Iam talking about the proper support of the tinkerpop gremlin specification. Tinkerpop3 gremlin console support the following variants: gremlin> graph = TinkerGraph.open(); ==>tinkergraph[vertices:0 edges:0] gremlin> graph.variables().set('systemAdmins',['stephen','peter','pavel']) ==>null gremlin> graph.variables() ==>variables[size:1] gremlin> graph.variables().set('systemAdmins',[10, 11]) ==>null gremlin> graph.variables().set('systemAdmins',['stephen','peter','pavel'] as String[]) ==>null gremlin> graph.variables().set('systemAdmins',[12, 13] as Integer[]) ==>null gremlin>