Skip to content

Odd behavior in context of orderability of different agtypes. #870

@CapnSpek

Description

@CapnSpek

Describe the bug
While evaluating the inequality between an edge and a path, it appears that the orderability is totally bypassed and true/false is returned based on the sign of the inequality.

How are you accessing AGE (Command line, driver, etc.)?
Command line

What data setup do we need to do?
Apache AGE, and any graph with atleast 2 vertices and 1 edge.

SELECT * from cypher('my_graph_name', $$
  CREATE (:Person {name: 'John'})-[:Knows]->(:Person {name: 'Jonh'})
$$) as (a agtype);

What is the necessary configuration info needed?
Any graph with atleast 2 vertices and 1 edge.

What is the command that caused the error?

In regards to orderability between different agtypes: -
https://age.apache.org/age-manual/master/intro/comparability.html

I was testing the orderability between path and an edge, and I found this odd behavior: -

Comparing a path with an edge with p > e inequality: -

test=# SELECT *
FROM cypher('test', $$
        WITH [{id: 0, label: "label_name_1", properties: {i: 0}}::vertex,
            {id: 2, start_id: 0, end_id: 1, label: "edge_label", properties: {i: 0}}::edge,
           {id: 1, label: "label_name_2", properties: {}}::vertex
           ]::path as p
MATCH (n)-[e]-(m) RETURN p>e
$$) AS (e agtype);
  e   
------
 true
 true
 true
 true
(4 rows)

Fair enough, same result holds when we compare it with p < e inequality

test=# SELECT *
FROM cypher('test', $$
        WITH [{id: 0, label: "label_name_1", properties: {i: 0}}::vertex,
            {id: 2, start_id: 0, end_id: 1, label: "edge_label", properties: {i: 0}}::edge,
           {id: 1, label: "label_name_2", properties: {}}::vertex
           ]::path as p
MATCH (n)-[e]-(m) RETURN p<e
$$) AS (e agtype);
   e   
-------
 false
 false
 false
 false
(4 rows)

But look, when we change the inequality to e > p

test=# SELECT *
FROM cypher('test', $$
        WITH [{id: 0, label: "label_name_1", properties: {i: 0}}::vertex,
            {id: 2, start_id: 0, end_id: 1, label: "edge_label", properties: {i: 0}}::edge,
           {id: 1, label: "label_name_2", properties: {}}::vertex
           ]::path as p
MATCH (n)-[e]-(m) RETURN e>p
$$) AS (e agtype);
  e   
------
 true
 true
 true
 true
(4 rows)

We get true again, which is in direct contradiction to p > e inequality

And when we check for e < p, we get false again

test=# SELECT *
FROM cypher('test', $$
        WITH [{id: 0, label: "label_name_1", properties: {i: 0}}::vertex,
            {id: 2, start_id: 0, end_id: 1, label: "edge_label", properties: {i: 0}}::edge,
           {id: 1, label: "label_name_2", properties: {}}::vertex
           ]::path as p
MATCH (n)-[e]-(m) RETURN e<p
$$) AS (e agtype);
   e   
-------
 false
 false
 false
 false
(4 rows)

Again, in direct contradiction to the first 2 results.

Expected behavior
Would have expected p>e to be true under all scenarios.

Environment (please complete the following information):

  • Version: [age 1.3.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions