Fix SQL parser to accept nested projections in array concatenation expressions#2755
Fix SQL parser to accept nested projections in array concatenation expressions#2755
Conversation
Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
🧪 CI InsightsHere's what we observed from your CI run for 9ca8c38. 🟢 All jobs passed!But CI Insights is watching 👀 |
…ogress) Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
…orking) Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
|
@copilot the testa is failing: com.arcadedb.query.sql.ArrayConcatNestedProjectionTest||1 ❌||66ms| ❌ com.arcadedb.query.sql.ArrayConcatNestedProjectionTest |
The issue was that ArrayConcatExpression.splitForAggregation() had a different signature than other expressions - it only took CommandContext instead of (AggregateProjectionSplit, CommandContext). This caused it to create a new AggregateProjectionSplit for each element instead of using the shared one, resulting in aggregate items being added to throwaway lists. Changes: - Updated ArrayConcatExpression.splitForAggregation() signature to match other expressions - Updated Expression.splitForAggregation() to pass aggregateSplit parameter to ArrayConcatExpression - ArrayConcatExpressionElement now properly attaches nested projections to aggregate projection items The test ArrayConcatNestedProjectionTest now passes. Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
... Fixed in commit cc4c6f3. The test was failing because |
|
@copilot replace the system.out in ArrayConcatNestedProjectionTest with assertions if possible and remove them |
Removed all System.out.println statements and simplified the test to focus on the main test case from the issue. The test is now cleaner and only contains assertions. Co-authored-by: robfrank <413587+robfrank@users.noreply.github.com>
||after nested projection:{x}list({'x':1}):{x} || []returns[{x:1}]Summary
This PR fixes the SQL parser to accept and correctly execute nested projections in array concatenation expressions.
What Works ✅
SELECT list({'x':1}):{x} || []now returns[{"x":1}]as expectedRoot Cause
The issue had two parts:
ProjectionItem, not in array concatenation elementsArrayConcatExpression.splitForAggregation()had the wrong signature and created separate aggregate split contexts for each elementFix
Grammar changes:
NestedProjectiontoArrayConcatExpressionElementruleExecution changes:
ArrayConcatExpressionElementexecutes nested projections after base expressionArrayConcatExpressionElement.splitForAggregation()attaches nested projections to aggregate projection itemsCritical fix:
ArrayConcatExpression.splitForAggregation(CommandContext)tosplitForAggregation(AggregateProjectionSplit, CommandContext)to match other expressionsAll engine tests pass (1407 tests, 0 failures).
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.