Skip to content

Parse SQL Server 2025 JSON syntax - #71

Merged
kyleconroy merged 1 commit into
claude/project-thread-4tipff-queryfrom
claude/project-thread-4tipff-json
Dec 1, 2026
Merged

kyleconroy merged 1 commit into
claude/project-thread-4tipff-queryfrom
claude/project-thread-4tipff-json

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Stacked on #70 (base: claude/project-thread-4tipff-query), which is stacked on #69.

Summary

Parses the SQL Server 2025 JSON syntax covered by tests added in #69:

  • JSON_OBJECTAGG / JSON_ARRAYAGG, with OVER (...) and JSON_ARRAYAGG(... ORDER BY ...) → FunctionCall.JsonOrderByClause
  • RETURNING data_type on JSON constructors and JSON_VALUE → FunctionCall.ReturnType
  • JSON_QUERY(..., path WITH ARRAY WRAPPER) → WithArrayWrapper
  • key:value where key: has no space: ScriptDom lexes it as a label, so the key's span includes the colon
  • CREATE JSON INDEX ... [FOR ('path', ...)] [WITH (...)] → CreateJsonIndexStatement, plus the OPTIMIZE_FOR_ARRAY_SEARCH index option
  • FOR JSON / FOR XML clause spans omit the keywords inside any parentheses (scalar subqueries as well as derived tables). The derived-table-only depth counter is replaced by a general paren depth.

JSON_OBJECT / JSON_ARRAY / JSON_OBJECTAGG / JSON_ARRAYAGG now share one parser and keep the function name's original spelling.

Enables 12 todo tests (JsonFunctionTests170, JsonArrayAggOrderBy170, JsonObjectAggOverClause170, JsonIndexTests170, ComplexJsonObjectFunctionTests160/170 and baselines).

Test plan

  • go test ./...
  • go test ./parser/... -check-todo enabled the 12 tests

Generated by Claude Code

- JSON_OBJECTAGG / JSON_ARRAYAGG, including OVER and JSON_ARRAYAGG ORDER BY
- RETURNING data_type for JSON constructors and JSON_VALUE
- JSON_QUERY ... WITH ARRAY WRAPPER
- "key:" label spans for JSON key-value pairs (matches ScriptDom lexing)
- CREATE JSON INDEX with FOR paths and OPTIMIZE_FOR_ARRAY_SEARCH
- FOR JSON spans inside any parenthesized query (scalar subqueries too)

Enables 12 todo tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4JQ53XPMqUY3Yc1vdv
@kyleconroy kyleconroy self-assigned this Dec 1, 2026
@kyleconroy
kyleconroy added this pull request to stack #73 December 1, 2026 06:14
@kyleconroy
kyleconroy merged commit cdc7056 into main Dec 1, 2026
1 check 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.

2 participants