Skip to content

fix(cypher): keep field metadata on returned properties - #204

Merged
prrao87 merged 1 commit into
mainfrom
fix/csr-field-metadata
Nov 25, 2026
Merged

prrao87 merged 1 commit into
mainfrom
fix/csr-field-metadata

Conversation

@prrao87

@prrao87 prrao87 commented Nov 25, 2026

Copy link
Copy Markdown
Member

Why

With CSR on, a property column returned from a query that crosses a relationship lost its source field's Arrow metadata. The values were right, but extension types such as GeoArrow (ARROW:extension:name: geoarrow.point) came back as plain lists, structs or binaries, so consumers could no longer recognise them. Single-node queries and the join path kept the metadata.

MATCH (v:Visit)-[:AT]->(p:Place) RETURN v.day AS day, p.location AS here
before after
use_csr=False here keeps geoarrow.point unchanged
use_csr=True here has no metadata here keeps geoarrow.point

Closes #201.

What changed

Several places rebuilt output fields from just name, type and nullability, which drops field metadata. They now rename the source field instead, so its metadata carries over:

  • CSR expansion: target node properties and relationship properties.
  • The CSR node lookup operator.
  • Node and relationship properties returned from variable-length path matching.
  • Column-name normalisation of result schemas, which the SQL engine also uses, so SqlEngine results now keep field metadata too.

Values and column names don't change. Computed columns (count(), literals, expressions) still carry no metadata.

Validation

  • New Rust test returned_properties_keep_field_metadata covers single-node, one-hop (aliased and not), variable-length and relationship-property queries with CSR on and off. It fails on main and passes here.
  • New Python test writes a Lance graph with geoarrow.point list and struct columns, a geoarrow.wkb binary column and a geoarrow.wkb relationship column, and checks them in both modes.
  • cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace, make test (1784 passed) and make lint pass locally.
  • Not run locally: Node.js tests, docs build and spell check. No Node or docs files changed; CI will cover them.

🤖 Generated with Claude Code

The CSR target and relationship lookups, variable-length path outputs and
schema normalisation rebuilt output fields from name, type and nullability,
dropping Arrow field metadata such as extension type names. With CSR on,
a property returned across a relationship lost, for example, its
geoarrow.point tag. Rebuild these fields with Field::with_name so the
metadata carries over.

Closes #201
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0105fda
Status: ✅  Deploy successful!
Preview URL: https://33db0b4a.lance-csr.pages.dev
Branch Preview URL: https://fix-csr-field-metadata.lance-csr.pages.dev

View logs

@prrao87
prrao87 marked this pull request as ready for review November 25, 2026 02:22
@prrao87
prrao87 merged commit ddeecc1 into main Nov 25, 2026
9 checks passed
@prrao87
prrao87 deleted the fix/csr-field-metadata branch November 25, 2026 02:25
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.

Keep Arrow field metadata on returned property columns when a Cypher query crosses a relationship.

1 participant