Add vertex and edge composite types with direct field access optimization by MuhammadTahaNaveed · Pull Request #2303 · apache/age

@MuhammadTahaNaveed

…tion

- Introduce vertex and edge as pg composite types
  vertex: (id, label, properties)
  edge: (id, label, start_id, end_id, properties)
- Property access (a.name) now directly uses a.properties for
  agtype_access_operator instead of rebuilding via _agtype_build_vertex/edge
- Optimize accessor functions (id, properties, label, type, start_id, end_id)
  to use direct FieldSelect on composite types instead of agtype functions
- Add casts: vertex/edge to agtype, vertex/edge to json/jsonb
- Add eq and not eq ops for vertex/edge composite types.
- Fix label_name specific routine to use cache instead of ag_label scan
- Write/update clauses have executors strictly tied to agtype, due to which
  the variables after any write/update clause are carried forward as agtype.
- Allows users to completely skip agtype build functions and return vertex/edge
  for pure read queries.
- Change _label_name to return agtype since record comparisons are not
  allowed with cstring. Consequently, _agtype_build_vertex/edge now accept
  agtype as label.
- Fix MERGE clause type mismatch when accessing properties from previous
  MATCH clauses by wrapping columns with agtype_volatile_wrapper
  before namespace lookup.
- Update expression index in pgvector.sql, since now it uses raw properties column
  instead of _agtype_build_vertex/edge.
- Add regression tests

Assisted-by AI