RedisGraph / redisgraph-go

A Golang client for redisgraph
https://redisgraph.io
BSD 3-Clause "New" or "Revised" License
132 stars 38 forks source link

Query failing with error: "redigo: unexpected type for Values, got type []uint8" #12

Closed Justin-Hellreich closed 5 years ago

Justin-Hellreich commented 5 years ago

This error seems to originate here https://github.com/RedisGraph/redisgraph-go/blob/0d6a4659a1b54d5789de6bdfcb4bb69bfe873ad1/client.go#L207 We're currently running a version from this commit 0d6a4659a1b54d5789de6bdfcb4bb69bfe873ad1.

This is pretty far from a reproducible example, but I'd appreciate any suggestions/advice here.


In terms of a more usable example, I've managed to see a similar error while running the sample code from the readme (below). Also running on the same version (0d6a4659a1b54d5789de6bdfcb4bb69bfe873ad1).

The error here is

redigo: unexpected type for Strings, got type []uint8

The code is essentially verbatim from the README, just added a print for the error:

func main() {
    conn, _ := redis.Dial("tcp", "0.0.0.0:6379")
    defer conn.Close()

    graph := rg.Graph{}.New("social", conn)

    john := rg.Node{
        Label: "person",
        Properties: map[string]interface{}{
            "name":   "John Doe",
            "age":    33,
            "gender": "male",
            "status": "single",
        },
    }
    graph.AddNode(&john)

    japan := rg.Node{
        Label: "country",
        Properties: map[string]interface{}{
            "name": "Japan",
        },
    }
    graph.AddNode(&japan)

    edge := rg.Edge{
        Source:      &john,
        Relation:    "visited",
        Destination: &japan,
    }
    graph.AddEdge(&edge)

    graph.Commit()

    query := `MATCH (p:person)-[v:visited]->(c:country)
           RETURN p.name, p.age, v.purpose, c.name`
    rs, err := graph.Query(query)
    fmt.Println(err) // ERROR is here

    rs.PrettyPrint()
}
Justin-Hellreich commented 5 years ago

Quick update here: I grabbed image 1.2.2 (https://hub.docker.com/r/redislabs/redisgraph/tags) and am not seeing the problems anymore. So this issue seems to have cropped up in the latest redisgraph docker image (from seven days ago).

swilly22 commented 5 years ago

Hi, executing against the current master branch of redisgraph:

`package main

import ( "github.com/gomodule/redigo/redis" rg "github.com/redislabs/redisgraph-go" "fmt" )

func main() { conn, _ := redis.Dial("tcp", "0.0.0.0:6379") defer conn.Close()

graph := rg.GraphNew("social", conn)

john := rg.Node{
    Label: "person",
    Properties: map[string]interface{}{
        "name":   "John Doe",
        "age":    33,
        "gender": "male",
        "status": "single",
    },
}
graph.AddNode(&john)

japan := rg.Node{
    Label: "country",
    Properties: map[string]interface{}{
        "name": "Japan",
    },
}
graph.AddNode(&japan)

edge := rg.Edge{
    Source:      &john,
    Relation:    "visited",
    Destination: &japan,
}
graph.AddEdge(&edge)

graph.Commit()

query := `MATCH (p:person)-[v:visited]->(c:country)
       RETURN p.name, p.age, v.purpose, c.name`
rs, err := graph.Query(query)
fmt.Println(err) // ERROR is here

rs.PrettyPrint()

}`

I'm getting:

go run test.go
<nil>
+----------+-------+-----------+--------+
|  p.name  | p.age | v.purpose | c.name |
+----------+-------+-----------+--------+
| John Doe |    33 | <nil>     | Japan  |
+----------+-------+-----------+--------+

Can you please make sure you're testing against the latest version of both RedisGraph and redisgraph-go?

Thank you.

Justin-Hellreich commented 5 years ago

Hi, that seems to resolve the issue in that test file but unfortunately, we're stuck for now on a version of this module from before the recent refactor (https://github.com/RedisGraph/redisgraph-go/pull/10). Specifically our version is from this commit: https://github.com/RedisGraph/redisgraph-go/commit/0d6a4659a1b54d5789de6bdfcb4bb69bfe873ad1, which seems to be incompatible with the latest changes to redisgraph. We'll have to lock to an earlier version of redisgraph and circle back to this later.

ChrisSandison commented 5 years ago

We are still experiencing this problem. Can you confirm what version of redigo this runs with? Our is loading v2.0.0

Additionally, is it possible to bump the client release version? It looks like there hasn't been one for a while https://github.com/RedisGraph/redisgraph-go/releases

swilly22 commented 5 years ago

@ChrisSandison I'm not specifying any redigo version, as such I believe the latest will be used, I will bump the client release version.

swilly22 commented 5 years ago

Release 1.99.0

ChrisSandison commented 5 years ago

Looks like that did it. You can close this thread