关于不同agtype之间的可订购性:- https://age.apache.org/age-manual/master/intro/comparability.html
我在测试path和edge之间的有序性,我发现了这个奇怪的行为:-
将路径与具有p > e
不等式的边进行比较:-
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)
很公平,当我们将其与p < e
不等式进行比较时,同样的结果也成立
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)
但是当我们把不等式改成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)
我们又得到了一个与p > e
不等式直接矛盾的结果
当我们检查e < p
时,我们再次得到false
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)
再次,与前两个结果直接矛盾。
似乎在边和路径的情况下,不管哪个是哪个'〉'不等式产生真,而'〈'不等式产生假。
这是预期的行为还是错误?如果这是故意的行为那为什么?
1条答案
按热度按时间eufgjt7s1#
到目前为止,它似乎是无意的行为,因此,确实是一个bug。这是由于在代码中没有为路径和边明确分配优先级。
我已为此行为创建了一个问题https://github.com/apache/age/issues/870
同时也提出了一些改正的方法。