jrgemignani commented on code in PR #2302:
URL: https://github.com/apache/age/pull/2302#discussion_r2687916611


##########
src/backend/utils/adt/agtype.c:
##########
@@ -5409,10 +5409,14 @@ Datum age_id(PG_FUNCTION_ARGS)
         ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                         errmsg("id() argument must be a vertex, an edge or 
null")));
 
-    agtv_result = GET_AGTYPE_VALUE_OBJECT_VALUE(agtv_object, "id");
+    /*
+     * Direct field access optimization: id is always at index 0 for both
+     * vertex and edge objects due to key length sorting.
+     */

Review Comment:
   Asserts are problematic due to being compiled out - which leaves no 
protections in place at all; we need to move away from this. 
   
   This code suggestion also assumes all other agtype types are 5 pairs, which 
is invalid. Additionally, it assumes that a change in the number of pairs will 
cover a difference in the position of those pairs, which is also not true.
   



-- 
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