Skip to content

fix(#12397): toString() renders a point and the concatenation of a string with a map is refused - #12404

Merged
robfrank merged 2 commits into
ArcadeData:mainfrom
shaunpatterson:issue12397
Nov 20, 2026
Merged

robfrank merged 2 commits into
ArcadeData:mainfrom
shaunpatterson:issue12397

Conversation

@shaunpatterson

Copy link
Copy Markdown
Contributor

fix(#12397): toString() renders a point and the concatenation of a string with a map is refused

A point is a map at runtime in ArcadeDB (there is no dedicated geometry type yet, issue #4870), so toString() refused it with toString() cannot convert LinkedHashMap and the concatenation of a string with a point or a map answered the Java Map.toString() form, which prints the internal keys of the point (srid included) in a shape no point constructor or toString() accepts.

Behavior change

toString() of a point now answers the point literal, the way Neo4j answers it:

expression before after Neo4j 5.26.33
toString(point({x:1,y:2})) error point({x: 1.0, y: 2.0, crs: 'cartesian'}) point({x: 1.0, y: 2.0, crs: 'cartesian'})
toString(point({longitude:1,latitude:2})) error point({x: 1.0, y: 2.0, crs: 'wgs-84'}) point({x: 1.0, y: 2.0, crs: 'wgs-84'})
toString(point({x:1,y:2,z:3})) error point({x: 1.0, y: 2.0, z: 3.0, crs: 'cartesian-3d'}) point({x: 1.0, y: 2.0, z: 3.0, crs: 'cartesian-3d'})

The concatenation of a string with a map, or with a point, is now refused with the type error Neo4j raises:

expression before after Neo4j 5.26.33
'a' + point({x:1,y:2}) a{x=1.0, y=2.0, crs=cartesian, srid=7203} type error type error
'a' + {k:1} a{k=1} type error type error
{k:1} + 'a' {k=1}a type error type error

What did not change:

  • toString() of a map that is not a point is still refused, as it is in Neo4j.
  • The concatenation of a string with a string, with a number, and the concatenation and the append of a list are untouched.
  • The concatenation of a string with a temporal value, with a boolean and with a duration still answers the string form of the value, which Neo4j refuses: that divergence is not part of this issue and is left alone on purpose.

Notes

  • The rendering holds for a point read back from storage as well: a stored point is the same map of coordinate keys.
  • The srid is not part of the rendering: Neo4j prints the name of the coordinate reference system, and the srid is its numeric name.

Tests

  • engine/src/test/java/com/arcadedb/function/geo/PointToStringIssue12397Test.java, a new regression test that pins every answer of the tables above, plus the controls.

…on of a string with a map is refused

A point is a map at runtime, so toString() refused it with 'cannot convert LinkedHashMap' and the concatenation of a string with a point or a map answered the Java Map.toString() form, which prints the internal keys of the point (srid included) in a shape no point constructor or toString() accepts.

toString() now renders a point as the point literal, the way Neo4j renders it: point({x: 1.0, y: 2.0, crs: 'cartesian'}), with the z coordinate when the point has one. A map that is not a point is still refused.

The concatenation of a string with a map is refused with the type error Neo4j raises; a list is still concatenated and appended as before.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3968c3d0-41eb-4dfd-b345-beea59cbf58a
Commits

Reviewing files that changed from the base of the PR and between b2d042f and 5765d89.

Files selected for processing: 4

  • engine/src/main/java/com/arcadedb/function/convert/ToStringFunction.java
  • engine/src/main/java/com/arcadedb/function/geo/CypherPointFunction.java
  • engine/src/main/java/com/arcadedb/query/opencypher/ast/ArithmeticExpression.java
  • engine/src/test/java/com/arcadedb/function/geo/PointToStringIssue12397Test.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@github-actions github-actions Bot added engine Core engine: document/schema API geospatial Geospatial / spatial query, index, and CRS features no-issue The PR links no issue opencypher severity:minor Cosmetic, documentation, edge case, or a workaround exists triage:lgtm PR triage: nothing blocking, ready for a maintainer labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage: triage:lgtm · severity:minor · areas: opencypher, engine, geospatial · no-issue

Thanks for the PR. The change is small, focused and matches Neo4j behavior. I found no security concerns and nothing that has to change before merge. I could only read the diff and the base branch, so I didn't run any tests.

What I checked

  • ToStringFunction now renders a point-shaped map through the new CypherPointFunction.renderPoint. A map that isn't a point is still refused with a CommandSemanticException.
  • ArithmeticExpression now throws TypeMismatchException when + joins a string and a map or point. The temporal, boolean and duration concatenations are untouched, as the PR body says.
  • CypherValues.isPointShaped and TypeMismatchException both exist in the base branch.
  • The new PointToStringIssue12397Test covers 2D, 3D, WGS-84, a point read back from storage, the refusals and the controls. It uses the assertThat style from CLAUDE.md.
  • No other test or feature file in the repo refers to the old toString() cannot convert LinkedHashMap message.

Minor, non-blocking

  • The error message for the old toString() map case changed from cannot convert LinkedHashMap to cannot convert Map. This is fine, and the test only matches on "cannot convert".
  • isPointShaped is a heuristic: any map with crs plus numeric x and y counts as a point. toString() will render such a map as a point. The CypherValues Javadoc already notes this, so it is accepted.
  • The renderPoint Javadoc says coordinates are always doubles. A non-numeric x or y falls back to String.valueOf, which is harmless.
  • 'a' + map now raises an error where it used to return a string, so existing queries that relied on it will break. This is the stated intent and is documented in the PR body.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity

Metric Results
Complexity 4

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…nger names the map

The map is handled before that list now: a point is rendered and any other map is refused with its own message.
@github-actions github-actions Bot added triage:lgtm PR triage: nothing blocking, ready for a maintainer and removed triage:lgtm PR triage: nothing blocking, ready for a maintainer labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage: triage:lgtm · severity:minor · areas: opencypher, engine, geospatial · no-issue

Review

I found no blocking problems, and no security concerns. I could not run anything, so the checks below come from reading the diff and the base branch.

What the PR does

  • toString() of a point-shaped map now returns the Neo4j point literal. It uses the new CypherPointFunction.renderPoint.
  • A map that is not a point is still refused, with the same CommandSemanticException.
  • ArithmeticExpression.apply now throws TypeMismatchException when a string is concatenated with a map or a point. Before, it returned the Java Map.toString() form.
  • PointToStringIssue12397Test covers the 2D, 3D, WGS-84, stored-point, plain-map and concatenation cases, plus string and number controls.

Observations (non-blocking)

  1. Behavior change. 'a' + {k:1} used to succeed and now raises an error. The PR body states this and matches it to Neo4j, so it is intentional. It could still break existing openCypher tests or user queries that concatenate a string with a map. Please run the openCypher TCK and the other opencypher tests in engine to confirm nothing depended on the old behavior.
  2. Point detection is a heuristic. CypherValues.isPointShaped treats any map with a non-null crs and numeric x and y as a point. A user map such as {x:1, y:2, crs:'foo'} will therefore render as a point. The javadoc in CypherValues already documents this and the PR reuses it, so it is acceptable. A short comment saying so in ToStringFunction would help.
  3. Silent fallbacks in renderPoint. A missing crs renders as '', and a non-numeric coordinate falls back to String.valueOf. The caller guarantees x, y and crs are present, so this is only defensive. If you keep the public method, add a test that calls it directly.
  4. Test style. The tests follow the assertThat convention and use per-test database paths. Consider a test for a point with a null or absent z, and one for a list concatenated with a string, to confirm that path is untouched.

The change is small and focused, and it reuses existing helpers. It also respects the CLAUDE.md conventions on imports, final and test syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine Core engine: document/schema API geospatial Geospatial / spatial query, index, and CRS features no-issue The PR links no issue opencypher severity:minor Cosmetic, documentation, edge case, or a workaround exists triage:lgtm PR triage: nothing blocking, ready for a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants