Skip to content

fix(core): text rendering of nested objects and lists is recursive - #471

Merged
fupelaqu merged 3 commits into
mainfrom
fix/coerce-to-string-nested
Nov 21, 2026
Merged

fupelaqu merged 3 commits into
mainfrom
fix/coerce-to-string-nested

Conversation

@fupelaqu

Copy link
Copy Markdown
Contributor

Summary

A value's text now spells nested lists and objects recursively. This is the text the JDBC driver's getString and an Arrow VARCHAR cell give. Until now, an object or list nested in another came out as a Scala class name ({x: 1, y: ListMap(z -> 2)}, List(2, 3)), and nested bytes came out as an object hash ([B@1b6d3586).

Change

  • ValueCoercion.coerceToString spells every nested value by its own rule, at any depth, in the existing style:
    • {x: 1, y: {z: 2}}, [1, [2, 3]], [{a: 1}, {a: 2}];
    • nested bytes as base64;
    • a NULL inside a list or an object as null. A NULL cell is still a NULL.
  • Entries keep their own order, never sorted.
  • A value with no list, object or bytes inside is spelled exactly as before. The tests pin this byte for byte against the previous function.
  • Cost: a flat value takes the same branches, in the same order, and allocates nothing more. A list or an object is written into a single builder per call, whatever its depth.
  • Classes still rendered with toString: Option, Java collections, Scala Set, arrays other than Array[Byte], mutable Scala collections. Core puts none of them in a row cell. The top-hits bucket_root (an Option) reads as before.
  • documentation/client/gateway.md states the rule.

Testing

  • sql ValueCoercionSpec: the new cases fail on the base commit (3 of 13) and pass here, 13/13. They cover nested objects, lists of lists, lists of objects, nested bytes, nested NULLs, depth 3, and byte pins for every flat form. Core ResultSchemaSpec passes.
  • + compile passes on Scala 2.12 and 2.13.
  • Elasticsearch 8.18.3:
    • the new SchemaReadingSpec row, over a disabled object field holding nested objects, lists of objects and lists of lists, through both the LIMIT and the scroll routes: 1/1;
    • JavaClientSchemaConsumer*: 16/16.
  • CI lint line passes.
  • Not run locally: Elasticsearch 6.8, 7 and 9 (the new row runs on every client in CI).

Release note

JDBC getString and Arrow text cells spell nested objects and lists recursively ({x: 1, y: {z: 2}}), and nested bytes as base64, instead of a Scala class name or an object hash. Flat values are unchanged. There is no case-class arity change, so downstream modules only need the next core snapshot.

🤖 Generated with Claude Code

fupelaqu and others added 3 commits November 20, 2026 15:04
…CHEMA-17)

Story SCHEMA-17-R171. Reviewed: r0:must-fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rendering cost exactly (SCHEMA-17)

A NULL cell still reads as NULL (JDBC getString returns null, the Arrow
VARCHAR slot is null). The scaladoc's cost sentence names what a nested
rendering still allocates: a non-text leaf's or key's own text and
nested bytes' base64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds (SCHEMA-17)

The Elasticsearch 6 / 7 clients read _source without the document's key
order, the 8 / 9 clients keep it. The row now builds the multi-key object's
expected text in the received map's own iteration order, so it pins the
rendering rule on every client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fupelaqu
fupelaqu marked this pull request as ready for review November 21, 2026 11:32
@fupelaqu
fupelaqu merged commit 104e338 into main Nov 21, 2026
4 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.

1 participant