Untitled conversation
- User
[SQL] "expand" projection is always named "value" ignoring "AS"
ArcadeDB Server v26.5.1 (build b6d08fee549dd5930303b362223869901aab0fac/1778533954349/main)Running on Linux 6.17.0-29-generic - OpenJDK 64-Bit Server VM 25.0.3-eaUsing
expandin a projection, the result-set contains an property namedvalueinspite an alias of the formAS x:SELECT expand([1,2,3,4]) AS testresults in:
{"result":[{"value":1},{"value":2},{"value":3},{"value":4}]}Interface
No new interfaces are introduced.
- Assistant
Now let me find existing tests for expand to write the regression test in the same style.
- Assistant
Now I'll write the regression tests first (TDD), then implement. Verification will be running
ExpandStepTestvia Maven. - Assistant
Now implement. First,
QueryPlanningInfo: - Assistant
Now the planner. Let me look at line 1613 and the optimizeQuery site:
- Assistant
Now compile and run the tests:
- Assistant
All 13 pass. Now run the related tests that exercise expand and the planner:
- Assistant
That test expands maps (unaffected by the scalar alias path), but let me run it to confirm:
- Assistant
All tests pass. The fix is complete:
Changes
Root cause: When the planner rewrites
SELECT expand(...) AS xinSelectExecutionPlanner.optimizeQuery(), it replaces the projection with the expand content and discards the alias.ExpandStepthen hard-coded"value"as the property name when wrapping expanded scalar values.Fix (3 files):
QueryPlanningInfo.java- addedexpandAliasfield (also propagated incopy()) to carry the explicit alias declared on the expand() projection.SelectExecutionPlanner.java:699- captures the alias from the projection item before it's replaced bygetExpandContent(), andhandleExpand()passes it to the step.ExpandStep.java- new constructor accepting the alias; expanded scalars are now wrapped in a property named by the alias, falling back to when no alias is declared (backward compatible).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.