Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

There is a redisgraph client for Elixir here: https://github.com/crflynn/redisgraph-ex

It generally works, though it is old (4 years) and some things have changed, I'm about to fix that.

One thing I try to figure out is the format of the result-records.
The parsing works up to point in the code block below, but fails on a wrong assumption about what the int in the header means.
I need some kind of reference for this, the code refers to this dead link:

https://oss.redislabs.com/redisgraph/client_spec/

I write behind <-- what I understand, behind <~~ whats unclear.

# QUERY: "MATCH (p:person)-[v:visited]->(c:country) RETURN c.name, p, v"
raw_result_set: [
    [                                    <-- this is the header
      [
         1,                              <~~ what does this number indicate?
         "c.name"
      ], 
      [1, "p"], [1, "v"]], 
    [                                    <-- this is the list of solutions
      [                                  <-- this is the first solution
        [                                <-- cell in colum-0, refers to "c.name" 
          2,                             <~~ this number seems to indicate the datatype, here str
          "Japan"                        <~~ the value. as this has only two elems and is not type 7 or 8 its a scalar!?
        ],                    
        [
          8,                             <~~ this number seems to indicate a node
          [
            1,                           <-- internal node-id
            [1],                         <-- label indices, here: "person"
            [
              [
                 0,                      <-- prop-key index, here: "name"
                 2,                      <~~ data-type, here str
                 "John Doe"], 
              [1, 2, "single"], [2, 3, 33], [3, 2, "male"]
            ]
          ]
        ],
        [7, [0, 0, 1, 0, []]]            <~~ 7 seems to indicate a relation, array-field unclear
      ]
    ],
    ["Cached execution: 0", ...]
  ],
  labels: ["country", "person"],
  property_keys: ["name", "status", "age", "gender"],
  relationship_types: ["visited"]

So I think I understand everything but

  • what the int in the header means
  • what datatypes there are besides int, float, str
  • what "cell-types" there are besides scalar, rel, node
  • how the relation record is built
You must be logged in to vote

The protocol has two modes: detailed & compact

You can read more about here: https://docs.falkordb.com/design/client_spec.html

Replies: 1 comment · 5 replies

Comment options

The protocol has two modes: detailed & compact

You can read more about here: https://docs.falkordb.com/design/client_spec.html

You must be logged in to vote
5 replies
@georgfaust
Comment options

thanks this answers all my questions, could have found that myself I think, sorry.

One thing though: Here

https://docs.falkordb.com/design/client_spec.html#reading-the-header-row

it is stated that first elem of a header elem is of ColumnType enum but it is always 1 (COLUMN_SCALAR), though the columns in the example are COLUMN_NODE, COLUMN_RELATION, COLUMN_SCALAR.

This is what broke the elixir-client. It parsed everything as scalar.

@AviAvni
Comment options

you are right see

/* Because the types found in the first Record do not necessarily inform the types

@georgfaust
Comment options

OK, but still, the docs are misleading here as you can't rely on this "backward compatibility".

Anyway, I got it working now.
I'll put some more effort in the client if we decide to use falkor in production and make a PR then.

Thanks for all the help!

@AviAvni
Comment options

the document say:

The first element is the ColumnType enum, which as of RedisGraph v2.1.0 will always be COLUMN_SCALAR. This element is retained for backwards compatibility, and may be ignored by the client unless RedisGraph versions older than v2.1.0 must be supported.

what do you want to change?

@georgfaust
Comment options

no idea, I was just confused to see the backwards compatibility advertised there and also see the code crash relying exactly on that.

Answer selected by georgfaust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.