Repository navigation
Present default-label vertices and edges consistently across access paths - #2614
Open
ksaiharshavinay wants to merge 1 commit into
Open
ksaiharshavinay wants to merge 1 commit into
ksaiharshavinay wants to merge 1 commit into
Conversation
…aths Vertices and edges in the default labels (_ag_label_vertex and _ag_label_edge) are presented as having no label when they are built by pattern matching or CREATE, but startNode()/endNode() and the VLE path builder used the internal label name, so the same vertex could report labels() as ["_ag_label_vertex"] or [""] depending on how it was reached - e.g. when rebound by id across an OPTIONAL MATCH barrier. Add get_display_label_name() and use it wherever a vertex or edge is reconstructed for output: get_vertex() (startNode, endNode and _get_vertex_by_graphid) and the VLE path/edges builders. _label_name() now uses the same helper. Update the affected regression expectations and add a regression test comparing labels() across access paths. Fixes apache#2612
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2612.
A vertex that lives in the default vertex label (
_ag_label_vertex)was presented with two different labels depending on how it was
reached:
(
"label": "",labels()->[""]) - the "no label" presentationAGE has used since its early versions, via
_label_name();startNode()/endNode()(and_get_vertex_by_graphid) presentedit as
"_ag_label_vertex", and VLE paths did the same.So in the reported case, two isomorphic queries disagree: rebinding
an endpoint by id across OPTIONAL MATCH barriers changed
labels(alias2)from["_ag_label_vertex"]to[""]whileid()and
properties()agreed.This change makes the reconstruct-for-output sites use the same
presentation:
get_display_label_name()in ag_label.c, mapping the defaultvertex/edge label names to
"", and use it in_label_name()(replacing its inline check).
get_vertex()in agtype.c (used bystartNode(),endNode()and_get_vertex_by_graphid) now builds the vertex with the displaylabel. The real label name is still used for the table lookup.
from the label table oid through the same helper, for vertices and
edges.
Regression: updated expectations in cypher_match, cypher_unwind,
cypher_with, cypher_vle and age_global_graph (only the label string
of default-label vertices/edges in the affected outputs changed),
and a new test in expr.sql comparing
labels()for the same vertexacross pattern matching, startNode()/endNode(), an OPTIONAL MATCH
id-rebind, and a variable-length path. Full suite: all 43 tests
pass (PG 18.6, AGE master).
Disclosure: this fix was developed with AI assistance (Claude), and
every change was reproduced, tested and reviewed locally by me.