CapnSpek commented on issue #870:
URL: https://github.com/apache/age/issues/870#issuecomment-1545592359

   Looking at the regression tests that relate to orderability in 
/regress/sql/agtype.sql line number 506
   The order that that was originally intended and implemented is:-
   -- Object < List < String < Boolean < Integer = Float = Numeric < Null
   
   It does not mention anything about Edge, Vertex, Path, Array, Map.
   
   Looking at how the regression tests are written, for example: -
   `SELECT agtype_in('[1,3,5,7,9,11]') < '"string"';`  (line number 514)
   And the fact that in `agtype_util.c`
   array has a lower priority than string, it becomes obvious that 'List' was 
supposed to refer to 'Arrays' when they wrote 'List < String'
   
   That solves the part
   Array < String < Boolean < Integer = Float = Numeric < Null
   
   Leaving just object part to be specified
   The priority of vertex is already defined to be less than array and more 
than any other object in the code. (line 200 agtype_util.c)
   ```
   if (type == AGTV_OBJECT)
           return 0;
       if (type == AGTV_VERTEX)
           return 1;
       if (type == AGTV_ARRAY)
           return 2;
   ```
   That gives us
   Object < Vertex < Array < String < Boolean < Integer = Float = Numeric < Null
   
   If Edge, Path, and Map are all considered to be "objects" and assigned a 
priority, that would fix the issue.
   
   Presuming that orderability was chosen over comparability in order to allow 
for the sorting, grouping, of output, then
   we can dissect the order like this
   
   Null - Numbers - Booleans - Strings - Arrays - Graph elements - Other 
objects.
   
   In that case: -
   Null -> Then numeric -> Then boolean -> Then string -> Then arrays -> Then 
vertices (graph element)
   Continuing this trend, it should go like
   -> Edges (graph element) -> Paths (collection of graph elements) -> Objects 
(Maps for example)
   
   So in the end I recommend extending the current priority order to this
   
   Object - 0
   Path - 1
   Edge - 2
   Vertex - 3
   Array - 4
   String - 5
   Boolean - 6
   Numbers -7
   Null - 8
   
   This does not change anything in the current priority order, or the way it 
was intended to be, or the spirit from which it seems to arise from.
   It only adds further micro-priorities among previously undefined objects.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to