Skip to content

feat: add support for RETURN DISTINCT keyword#10

Merged
sonesuke merged 2 commits intomainfrom
fix/remove-label-field-use-array-key-as-label
Mar 30, 2026
Merged

feat: add support for RETURN DISTINCT keyword#10
sonesuke merged 2 commits intomainfrom
fix/remove-label-field-use-array-key-as-label

Conversation

@sonesuke
Copy link
Copy Markdown
Owner

@sonesuke sonesuke commented Mar 30, 2026

Summary

  • Add support for RETURN DISTINCT keyword
  • Previously DISTINCT was not recognized as a keyword and treated as a column name, causing {"DISTINCT": "null"} in results

Changes

  • Grammar: Add DISTINCT keyword, make it optional in return_clause
  • AST: Add distinct: bool field to ReturnClause
  • Parser: Detect DISTINCT token and set flag on parsed clause
  • Executor: Deduplicate result rows when distinct is true
  • Tests: Add parser and executor tests for DISTINCT behavior

Test plan

  • cargo test — all 71 tests pass
  • Parser correctly recognizes RETURN DISTINCT vs plain RETURN
  • Executor deduplicates identical rows
  • Pre-existing queries without DISTINCT remain unchanged

🤖 Generated with Claude Code

sonesuke and others added 2 commits March 30, 2026 08:13
Previously, `RETURN DISTINCT` caused a parse error because DISTINCT
was not recognized as a keyword and was treated as a column name.
This adds DISTINCT parsing and row deduplication in the executor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonesuke sonesuke changed the title fix: remove label_field concept, add RETURN DISTINCT support feat: add support for RETURN DISTINCT keyword Mar 30, 2026
@sonesuke sonesuke merged commit ab6fdb7 into main Mar 30, 2026
4 checks passed
@sonesuke sonesuke deleted the fix/remove-label-field-use-array-key-as-label branch March 30, 2026 08:22
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