Ratel UI dies on some geo queries

I have come across two issues where Ratel UI completely dies when switching to the “Geo” tab.

Geo predicates having default type

When I start with a fresh Dgraph cluster (v20.11.0-rc1-142-g79f6e8edc) and add the following data (without a schema, so all predicates have default type):

{
  set {
    _:berlin <name> "Berlin" .
    _:berlin <location> "{\"type\": \"Point\", \"coordinates\": [13.41053, 52.52437]}" .
  }
}

and run this query in Ratel (both latest and dev) and switch to the “Geo” tab, it completely dies:

{
  query(func: has(location)) {
    uid
    name
    location
  }
}

When I change the schema as follows:

<location>: geo @index(geo) .

The “Geo” tab does not die anymore.

Syntax error in near() function kills the “Geo” tab

After changing the schema to

<name>: string @index(exact) .

and re-adding above data:

upsert {
  query {
    q(func: eq(<name>, "Berlin")) { node as <uid> }
  }
  mutation {
    set {
      uid(node) <name> "Berlin" .
      uid(node) <location> "{\"type\": \"Point\", \"coordinates\": [13.41053, 52.52437]}" .
    }
  }
}

I can run this query, switch to the “Geo” tab get the expected result map:

{
  query(func: near(location, [13.41053, 52.52437], 1000), first: 1) {
    uid
    name
    location
  }
}

When I then break the syntax of the near() function, Ratel UI dies. For instance, remove a comma or the 1000 argument. The UI does not die when breaking the syntax outside the near() function. Other geo functions might also be affected.

FYI @EnricoMi, this issue has been accepted as a bug

1 Like