zlfben
zlfben
ATApache TinkerPop
Created by zlfben on 4/17/2024 in #questions
Unable to deserialize results with Gremlin-go client + JanusGraph
Thanks for the replies! In the end I just built a small gremlin broker using gremlin_python + Graphson serializer and called the broker in my Golang code. Hopefully future updates of gremlin-go or JanusGraph can solve this issue.🤞
14 replies
ATApache TinkerPop
Created by zlfben on 4/17/2024 in #questions
Unable to deserialize results with Gremlin-go client + JanusGraph
Thanks. Just tried JanusGraph 0.6.3. With out of box configuration it worked well with gremlin-go's graphBinary serialization. However, it doesn't support my old configuration (shown below). After setting these for the JanusGraph, it seemed to have a lot of issues setting any types of vertex ids (long, string, etc.). I do need to use UUID as my vertex IDs - is there any way to configure JanusGraph 0.6.3 to support that, or is it only available in 1.0 or later?
JANUSGRAPH_RELATION_DELIMITER: "@"
janusgraph.graph.set-vertex-id: "true"
janusgraph.graph.allow-custom-vid-types: "true"
JANUSGRAPH_RELATION_DELIMITER: "@"
janusgraph.graph.set-vertex-id: "true"
janusgraph.graph.allow-custom-vid-types: "true"
14 replies
ATApache TinkerPop
Created by zlfben on 4/17/2024 in #questions
Unable to deserialize results with Gremlin-go client + JanusGraph
Output (at result.All()):
panic: E0408: unknown data type to deserialize 0x0

goroutine 1 [running]:
main.main()
/home/apr16-2024/main.go:30 +0x44d
panic: E0408: unknown data type to deserialize 0x0

goroutine 1 [running]:
main.main()
/home/apr16-2024/main.go:30 +0x44d
Some notes: - I didn't have the above issue if I used the Gremlin-go's bytecode APIs (i.e., not a string, but constructing steps within Golang). - The above code also didn't have any issue when connecting to Tinkerpop or Neptune instead of JanusGraph. - The same query under the groovy console works. Ran into the same error using Gremlin-go's bytecode APIs:
package main

import (
"time"

gremlingo "github.com/apache/tinkerpop/gremlin-go/driver"
)

func main() {
endpoint := "ws://localhost:8182/gremlin"
var remoteConnection *gremlingo.DriverRemoteConnection

remoteConnection, err := gremlingo.NewDriverRemoteConnection(endpoint, func(settings *gremlingo.DriverRemoteConnectionSettings) {
settings.TraversalSource = "g"
settings.KeepAliveInterval = time.Duration(15 * time.Minute)
})
if err != nil {
panic(err)
}

g := gremlingo.Traversal_().WithRemote(remoteConnection)

resultList, err := g.V().Limit(2).ToList()
if err != nil {
panic(err)
}

for _, item := range resultList {
println(item.String())
}

defer remoteConnection.Close()
}
package main

import (
"time"

gremlingo "github.com/apache/tinkerpop/gremlin-go/driver"
)

func main() {
endpoint := "ws://localhost:8182/gremlin"
var remoteConnection *gremlingo.DriverRemoteConnection

remoteConnection, err := gremlingo.NewDriverRemoteConnection(endpoint, func(settings *gremlingo.DriverRemoteConnectionSettings) {
settings.TraversalSource = "g"
settings.KeepAliveInterval = time.Duration(15 * time.Minute)
})
if err != nil {
panic(err)
}

g := gremlingo.Traversal_().WithRemote(remoteConnection)

resultList, err := g.V().Limit(2).ToList()
if err != nil {
panic(err)
}

for _, item := range resultList {
println(item.String())
}

defer remoteConnection.Close()
}
I noticed in gremlin_python, I faced the same issue, but I was able to fix it by setting message_serializer=serializer.GraphSONMessageSerializer() in the DriverRemoteConnection to fix it. The issue seems to come from the default binary serializer after reading some Github Issues and the general channel. I suspect the issue is with the serializer my Golang code uses (the binary one), but I have no idea how it could be set to another serializer (Graphson) like gremlin_python does. Does anyone have some clue how to change the serializer in gremlin-go? Thanks!
14 replies