The property order of the returned results has changed
cooper-lzy opened this issue · comments
I checked opencypher specification and tck tests. And I also googled. Very few about this behavior.
# a tck case about add property
Scenario: Overwrite values when using +=
Given an empty graph
And having executed:
"""
CREATE (:X {name: 'A', name2: 'B'})
"""
When executing query:
"""
MATCH (n:X {name: 'A'})
SET n += {name2: 'C'}
RETURN n
"""
Then the result should be, in any order:
| n |
| (:X {name: 'A', name2: 'C'}) |
And the side effects should be:
| +properties | 1 |
| -properties | 1 |
Scenario: `properties()` on a node
Given an empty graph
And having executed:
"""
CREATE (n:Person {name: 'Popeye', level: 9001})
"""
When executing query:
"""
MATCH (p:Person)
RETURN properties(p) AS m
"""
Then the result should be, in any order:
| m |
| {name: 'Popeye', level: 9001} |
And no side effects
name/level are not ordered in the alphabet, and {}
is a map.
My suggestion is to clarify that: Properties have no guaranteed order
in the doc.
Thanks for taking care of this. The opencypher do not specify such a behavior, and i think there would not be one of such a specification. As said by @whitewum , we implement the map by an unordered map
, the order would not be guaranteed. As far as i know, this is not a big problem for using. So i'll close this issue first unless we really meet any using problems in real world.