Skip to content

fix(query): preserve entity properties across untyped matches - #185

Merged
prrao87 merged 2 commits into
hyperdimensionalcomputingai:mainfrom
MuddyBootsCode:codex/182-preserve-node-properties
Nov 21, 2026
Merged

prrao87 merged 2 commits into
hyperdimensionalcomputingai:mainfrom
MuddyBootsCode:codex/182-preserve-node-properties

Conversation

@MuddyBootsCode

@MuddyBootsCode MuddyBootsCode commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #182. An untyped relationship match now returns each node’s own properties. This applies to whole nodes, nodes inside paths, and stored relationship endpoints.

Problem and why it matters

A graph browser uses MATCH (a)-[]-(b) RETURN a, b to discover connections. On main, this query returned the correct document ID and label but dropped its title. A typed lookup on the same graph returned the title. The planner cast each relationship alternative to the first branch’s record layout, discarding fields that existed only in later branches.

Change

Merge marked entity property fields across branches before aligning their records. Reuse the path inventory’s existing rules for nullable fields and incompatible types. Descend through structs and lists to cover relationship endpoints and paths. The extra work is in schema planning and projecting wider records when labels have different fields.

Validation

  • The regression failed on main and passed with the fix in all four combinations of Arrow or Lance input and CSR on or off. Tests also check the page number on a relationship returned directly and inside a path.
  • The Rust workspace passed 725 tests. The Python suite and doctests passed 1,728 tests.
  • Rust format and Clippy, Python lint and type checks, the strict docs build, spelling, and all 18 executable Cypher guide examples passed.

All 44 SF1 queries returned their expected answers in both storage modes on both builds. Each suite ran twice per wheel per mode. Geometric mean latency changes were +0.7% in memory and +10.4% on disk for the 30-query suite, and −1.5% in memory and +7.0% on disk for the 14-query suite. The typed LDBC queries use the same execution plan on both builds, so we attribute the disk-backed timing differences to run-to-run variation. Five disk-backed queries initially exceeded a 20% slowdown. Their changes ranged from −21.2% to +8.7% in focused repeats. Another validation job was active at the start of every full run, limiting confidence in smaller timing differences.

Baseline 3e281dc3702e610c352314a285dcd051008f6cc1. The benchmarked Rust source matches PR commit 564d983302fab658bc5df6accd412b3dc5849f4e. The final commit also includes test and documentation updates made after the benchmark build. Both release wheels used Rust 1.96.0 and the macOS 26.2 Command Line Tools SDK on an Apple M5 Max with 128 GiB running macOS 27.0.1.

graph-benchmark-ldbc

Runner commit 199852076ba8dceb345e18eeb2f8ac04c73f3ea1.

memory

Query Main 1 ms Main 2 ms Branch 1 ms Branch 2 ms Mean change Baseline repeat change
Q1 1.076 1.065 1.136 1.104 +4.6% -1.1%
Q2 0.933 0.864 1.002 0.940 +8.2% -7.4%
Q3 0.925 1.062 1.103 1.093 +10.5% +14.7%
Q4 0.805 0.830 0.860 0.820 +2.7% +3.1%
Q5 1.632 1.524 1.571 1.557 -0.9% -6.6%
Q6 0.806 0.693 0.753 0.836 +6.0% -14.0%
Q7 1.786 1.784 1.807 1.834 +2.0% -0.1%
Q8 1.253 1.346 1.290 1.271 -1.5% +7.5%
Q9 1.340 1.350 1.307 1.343 -1.5% +0.7%
Q10 1.426 1.437 1.528 1.432 +3.4% +0.8%
Q11 2.586 2.591 2.687 2.572 +1.6% +0.2%
Q12 1.296 1.207 1.275 1.238 +0.4% -6.9%
Q13 1.584 1.396 1.439 1.509 -1.1% -11.9%
Q14 0.939 0.935 0.957 1.045 +6.8% -0.4%
Q15 1.006 0.995 0.989 0.957 -2.8% -1.1%
Q16 1.085 1.194 1.082 1.125 -3.2% +10.0%
Q17 1.653 1.819 1.678 1.721 -2.1% +10.1%
Q18 1.175 1.235 1.293 1.127 +0.4% +5.1%
Q19 1.831 1.930 1.900 1.757 -2.8% +5.4%
Q20 2.273 2.280 2.231 2.297 -0.5% +0.3%
Q21 1.365 1.232 1.228 1.324 -1.7% -9.8%
Q22 1.288 1.157 1.208 1.369 +5.4% -10.2%
Q23 1.272 1.421 1.258 1.368 -2.5% +11.7%
Q24 1.148 1.319 1.161 1.191 -4.6% +14.9%
Q25 1.326 1.371 1.410 1.303 +0.6% +3.4%
Q26 1.271 1.361 1.344 1.298 +0.4% +7.0%
Q27 1.411 1.584 1.470 1.456 -2.3% +12.3%
Q28 2.197 2.283 2.201 2.150 -2.9% +3.9%
Q29 1.316 1.172 1.204 1.341 +2.3% -10.9%
Q30 15.280 16.622 15.104 15.971 -2.6% +8.8%

Geometric mean of per-query branch/main ratios: 1.0068.

lazy

Query Main 1 ms Main 2 ms Branch 1 ms Branch 2 ms Mean change Baseline repeat change
Q1 2.113 1.473 1.537 2.554 +14.1% -30.3%
Q2 2.107 1.698 1.674 2.314 +4.8% -19.4%
Q3 1.476 0.913 1.060 1.509 +7.6% -38.1%
Q4 1.491 1.285 1.123 1.577 -2.7% -13.8%
Q5 2.711 2.837 2.590 2.961 +0.1% +4.7%
Q6 1.051 1.107 1.002 1.401 +11.4% +5.3%
Q7 1.501 1.549 1.494 2.040 +15.9% +3.2%
Q8 1.893 1.998 1.773 2.589 +12.1% +5.5%
Q9 1.432 1.657 1.843 2.758 +49.0% +15.7%
Q10 1.524 1.601 1.520 2.136 +17.0% +5.0%
Q11 2.589 3.068 2.628 3.481 +8.0% +18.5%
Q12 5.118 5.685 4.895 5.766 -1.3% +11.1%
Q13 1.721 1.825 1.725 2.213 +11.1% +6.0%
Q14 0.987 0.973 0.931 1.295 +13.6% -1.5%
Q15 1.019 1.176 0.989 1.804 +27.3% +15.3%
Q16 1.170 1.383 1.218 2.138 +31.4% +18.3%
Q17 2.145 2.461 2.188 3.226 +17.5% +14.8%
Q18 1.617 2.023 1.634 2.452 +12.3% +25.1%
Q19 2.018 2.688 1.761 2.765 -3.8% +33.2%
Q20 43.131 43.070 41.753 49.701 +6.1% -0.1%
Q21 1.361 1.253 1.323 1.612 +12.3% -7.9%
Q22 1.532 1.671 1.396 2.034 +7.1% +9.1%
Q23 1.409 2.093 1.378 2.334 +6.0% +48.6%
Q24 1.317 1.730 1.280 2.202 +14.3% +31.3%
Q25 1.475 2.042 1.634 2.457 +16.4% +38.4%
Q26 1.404 1.801 1.486 1.996 +8.6% +28.3%
Q27 1.819 2.399 1.754 2.652 +4.5% +31.9%
Q28 2.435 3.283 2.845 3.451 +10.1% +34.8%
Q29 1.580 2.088 1.495 2.082 -2.5% +32.1%
Q30 13.367 16.573 13.494 15.972 -1.6% +24.0%

Geometric mean of per-query branch/main ratios: 1.1040.

graph-benchmark-ldbc-complex

Runner commit a332324f2d4660b03d1d429d8ef99767af3981e5.

memory

Query Main 1 ms Main 2 ms Branch 1 ms Branch 2 ms Mean change Baseline repeat change
Q1 25.994 23.290 24.519 24.622 -0.3% -10.4%
Q2 3.123 2.690 2.888 2.819 -1.8% -13.9%
Q3 21.220 21.447 21.798 21.304 +1.0% +1.1%
Q4 6.653 6.635 6.321 6.493 -3.6% -0.3%
Q5 45.468 41.348 40.634 40.362 -6.7% -9.1%
Q6 26.551 23.329 23.676 24.024 -4.4% -12.1%
Q7 9.555 9.367 10.488 9.494 +5.6% -2.0%
Q8 2.388 2.396 2.426 2.663 +6.4% +0.3%
Q9 38.944 38.442 39.460 38.756 +1.1% -1.3%
Q10 14.718 15.005 14.529 14.462 -2.5% +2.0%
Q11 3.083 3.528 3.143 3.181 -4.3% +14.4%
Q12 17.939 16.835 17.979 16.311 -1.4% -6.2%
Q13 1.362 1.259 1.195 1.138 -11.0% -7.6%
Q14 262.322 253.369 265.364 264.905 +2.8% -3.4%

Geometric mean of per-query branch/main ratios: 0.9854.

lazy

Query Main 1 ms Main 2 ms Branch 1 ms Branch 2 ms Mean change Baseline repeat change
Q1 34.181 38.658 33.898 35.812 -4.3% +13.1%
Q2 26.062 26.034 27.270 27.557 +5.2% -0.1%
Q3 161.619 161.051 166.166 160.537 +1.2% -0.4%
Q4 15.142 14.073 14.224 14.106 -3.0% -7.1%
Q5 72.042 73.294 74.110 74.677 +2.4% +1.7%
Q6 24.703 26.470 26.182 25.010 +0.0% +7.2%
Q7 14.088 14.054 14.320 14.710 +3.2% -0.2%
Q8 3.465 3.481 3.603 4.004 +9.5% +0.5%
Q9 215.285 215.127 215.273 222.516 +1.7% -0.1%
Q10 24.440 23.439 23.599 28.609 +9.0% -4.1%
Q11 5.879 5.782 6.387 7.730 +21.1% -1.7%
Q12 19.391 21.660 19.064 24.543 +6.2% +11.7%
Q13 1.557 1.458 1.539 2.688 +40.2% -6.4%
Q14 275.363 272.983 269.925 349.681 +13.0% -0.9%

Geometric mean of per-query branch/main ratios: 1.0702.

Follow-up on disk-backed queries

The initial runs shared the Mac with another validation job. These queries were over 20% slower on average in the first comparison. Each was repeated twice per wheel with the same runner options.

Suite Query Main 1 ms Main 2 ms Branch 1 ms Branch 2 ms Mean change
graph-benchmark-ldbc 9 2.365 1.809 1.414 1.875 -21.2%
graph-benchmark-ldbc 15 1.499 1.317 1.141 1.210 -16.5%
graph-benchmark-ldbc 16 1.680 1.557 1.609 1.319 -9.5%
graph-benchmark-ldbc-complex 11 6.974 6.390 6.775 7.748 +8.7%
graph-benchmark-ldbc-complex 13 1.870 1.912 1.745 2.250 +5.6%

User impact

Graph browsers can display each connected node’s name or title from an untyped match. Fields absent from a label are null. Conflicting Arrow types for the same property produce a planning error that names the property. The Cypher guide and operator docs describe the behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T16:57:12.932115Z 564d983 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 564d983302

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@prrao87 prrao87 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MuddyBootsCode, many thanks for the PR!

The fix looks correct to me. One note on the description: the benchmark section reports the disk-backed runs as +10.4% and +7.0% slower, but this change can't slow down typed queries. When all branches already have the same types, merge_branch_field returns immediately and build_union adds no cast, so every typed LDBC query gets the same plan as on main. Could you add one sentence in the PR message above saying typed queries get an unchanged plan, so these deltas are noise? Or diff one EXPLAIN on each build to show it.

That will prevent future humans and their agents from chasing down an unneeded performance fix.

Comment thread docs/cypher.md Resolved
@prrao87
prrao87 merged commit a0ce515 into hyperdimensionalcomputingai:main Nov 21, 2026
9 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.

Untyped relationship patterns drop the properties of all but one node label

2 participants