-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AGE agtype_util.c] Fix issue #870 regarding orderability #994
Conversation
Hey @CapnSpek , can you add some regression tests for this change that indicate the desired behavior and check for edge cases? I think this change might warrant further discussion. @jrgemignani @rafsun42 @muhammadshoaib Thoughts? Thanks |
@CapnSpek Are you following these documentation for orders:
|
@rafsun42 the issue only arose when I noticed the ambiguity in the position of edge in the documentation, regarding which I created an issue here apache/age-website#143 Then after discovering the odd behaviour I created the issue #870 In which I and John discussed how the original purpose of having orderability was "orderability was chosen over comparability in order to allow for the sorting, grouping, of output." Based on this information, I extrapolated the currently present priority order (which did not include edge or path at all btw) Object, Vertex, Array String, Bool, Numbers, Null To Object, (Path, Edge), Vertex, Array, String, Bool, Numbers, Null. I reached on this decision because if the aim was orderability and grouping, then, it correctly orders types as:- Objects, Collection of graph elements (path), Graph elements (edges and vertices), Array, String, Bool, Numbers, Null. Because it only adds some priorities in between the previously defined priorities, and does not change the structure that previously was there, this change is backwards compatible, and fixes the bug adequately by defining the previously left ambiguous priorities. I'll come up with regression tests soon. |
@CapnSpek Sounds good. May I suggest the following order:
I believe |
My only issue with it is that we're changing the original priorities that are currently part of the code and it can have some unwanted effects. In the other solution, only some priorities are added in between the existing ones. I feel maybe having minimal changes to code can make it more backwards compatible and avoid any unwanted drawbacks. What do you think? |
@CapnSpek I am okay with your argument. I am just curious about the unwanted effects. What are the side effects other than regression tests giving result in different order? For example, do we use the |
@rafsun42 I think not. I'll test it further and get back to you regarding this by Wednesday. |
The function The function I changed the It also solves all the problems that were given in issue #870 . I think it is a good solution. Should I proceed to writing new regression tests? |
@CapnSpek All PRs should have [as complete as possible] regression tests for the work added, modified, or removed. You don't need to ask :) |
Thank you for the putting in the work with your thorough explanation and documentation of this issue @CapnSpek . What you are saying makes sense to me. |
While going through the regression tests relating to different agtypes (given in /regress/sql/agtype.sql )
I tried searching for a way to write an edge, or a vertex, or path that way, but I could not find anything. So, I wanted to ask, would it be fine if I write the test case in the form of a cypher query? |
I ran into a problem while testing it: - Even after changing the priorities in the While debugging, I discovered this issue does not arise from that function, but instead from
The function takes 2 agtype_container values as parameters (the two values to be compared). Then it initializes an iterator for both, and declares the result variable in which the result of the comparison will be stored, then returned. The issue takes place in the do-while loop: -
The bottom two lines of the code above set both The wrong I believe it might be because
Solution: - The correction can be made into a special case below line 370 as follows
That fixes the problem without any side effects. |
@jrgemignani Can you take a look at this PR? |
@CapnSpek Reviewed and requesting changes |
@CapnSpek I would like to see some more regression tests for these changes. In particular, regression tests showing sorting/order by. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add some more regression tests for sorting/order by.
So I wrote a test where a graph is created, then some vertices are added to that graph with a property having all the different agtypes for all the different vertices, and then I query for the vertices of that graph while also ordering them, and then the graph is dropped. However, it seems it changes the graph_id for the creation of a graph in the next set of regression tests (catalog.out), so I would be modifying that as well here. |
You can add your new regression tests to the end of the sql file. Just make sure to state, in comments, what the regression tests are for, what they will do, and their expected results. |
…dded regression tests Fixed issue apache#870 Odd behavior in context of orderability of different agtypes. Implemented the solution suggested here: apache#870 (comment) Clearance given here: apache#870 (comment) -Added regression tests for both comparibility and orderability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well. Thanks for adding the tests.
Thank you. |
I gave my review a week ago, but now that @rafsun42 and @jrgemignani have approved, I'll go ahead and merge it in. |
…dded regression tests (apache#994) Fixed issue apache#870 Odd behavior in context of orderability of different agtypes. Implemented the solution suggested here: apache#870 (comment) Clearance given here: apache#870 (comment) -Added regression tests for both comparibility and orderability
Fixed issue #870
Odd behavior in context of orderability of different agtypes.
Implemented the solution suggested here:
#870 (comment)