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:sqlSELECT expand([1,2,3,4]) AS testresults in:
json{"result":[{"value":1},{"value":2},{"value":3},{"value":4}]}Interface
No new interfaces are introduced.
- Assistant
Investigating how SQL
expandprojections handle aliases in the codebase. - Assistant
Implementing the fix: preserving the explicit
ASalias for primitive expand results, and defaulting tovaluewhen no alias is given. - Assistant
Fixed the bug where
expandprojections always named primitive resultsvalue, ignoring anASalias.Root cause
ExpandStephardcoded"value"when wrapping scalar elements from an expanded collection:103:105:engine/src/main/java/com/arcadedb/query/sql/executor/ExpandStep.java// before fix ((ResultInternal) nextElement).setProperty("value", nextElementObj);The explicit alias from
SELECT expand(...) AS testwas also dropped during query planning when theexpand()wrapper was stripped from the projection.Fix
-
Capture the alias during planning - When
optimizeQuerydetects an expand projection, it now stores the explicitASalias inQueryPlanningInfo.expandPropertyAliasbefore strippingexpand(). -
Pass alias to
ExpandStep-ExpandStepreceives the alias and uses it when wrapping scalar values. Without an explicit alias, it keeps the legacy default .
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.