Skip to content

fix(cypher): preserve node properties through WITH aggregation#465

Merged
DeusData merged 1 commit into
DeusData:mainfrom
KerseyFabrications:fix/cypher-with-node-props
Jun 23, 2026
Merged

fix(cypher): preserve node properties through WITH aggregation#465
DeusData merged 1 commit into
DeusData:mainfrom
KerseyFabrications:fix/cypher-with-node-props

Conversation

@KerseyFabrications

Copy link
Copy Markdown
Contributor

A node group variable carried through a WITH aggregation
(e.g. WITH g, count(*) AS c RETURN g.file_path) returned blank for every
property except its name: the carried virtual binding held only the group
key (the node's name) and lacked a store handle, so node_prop() could
neither read other fields nor compute degrees.
Fix: capture the node id of a bare node group-var in with_agg_find_or_create
and tag the carried virtual binding with it; in node_prop(), when such a stub
(id set, string fields unpopulated) is asked for a missing property, re-fetch
the full node via cbm_store_find_node_by_id and project it. Also propagate
the store onto virtual bindings so node_prop can re-fetch and compute
degrees. The stub gate is heuristic but never yields a wrong value — worst
case is one redundant indexed lookup. Adds regression test
cypher_exec_with_node_groupvar_prop.

Signed-off-by: Kris Kersey kris@kerseyfabrications.com

A node group variable carried through a WITH aggregation
(e.g. `WITH g, count(*) AS c RETURN g.file_path`) returned blank for every
property except its name: the carried virtual binding held only the group
key (the node's name) and lacked a store handle, so node_prop() could
neither read other fields nor compute degrees.
Fix: capture the node id of a bare node group-var in with_agg_find_or_create
and tag the carried virtual binding with it; in node_prop(), when such a stub
(id set, string fields unpopulated) is asked for a missing property, re-fetch
the full node via cbm_store_find_node_by_id and project it. Also propagate
the store onto virtual bindings so node_prop can re-fetch and compute
degrees. The stub gate is heuristic but never yields a wrong value — worst
case is one redundant indexed lookup. Adds regression test
cypher_exec_with_node_groupvar_prop.

Signed-off-by: Kris Kersey <kris@kerseyfabrications.com>
@KerseyFabrications
KerseyFabrications force-pushed the fix/cypher-with-node-props branch from 2bf474a to 8b03974 Compare June 14, 2026 20:12
@DeusData

Copy link
Copy Markdown
Owner

Thanks @KerseyFabrications — preserving node properties through WITH aggregation is a real fix and the regression test is good. One correctness issue before merge: using empty-string as the stub sentinel (if (str && str[0])) means a node legitimately stored with an empty string field (e.g. an empty file_path on a synthetic node) falls through to a re-fetch on every property access. Please use an explicit stub flag (or carry the node id through the aggregation path) instead of repurposing the empty-string sentinel. 🙏

@DeusData
DeusData merged commit 96c1fc3 into DeusData:main Jun 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants