-
-
Notifications
You must be signed in to change notification settings - Fork 56
feat: add support for DISTINCT clause to array_agg()
#316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request refactors the aggregation functions ArrayAgg and StringAgg by changing their inheritance from BaseOrderableFunction to BaseFunction. Both classes now utilize the OrderableTrait and a newly introduced DistinctableTrait to handle ORDER BY and DISTINCT clauses. Their parsing methods have been made public and extended to call trait-based methods (parseDistinctClause and parseOrderByClause). Additionally, the generated SQL is updated to include optional DISTINCT clauses. Test files have been reorganized into associative arrays with descriptive keys and now include scenarios with DISTINCT, concatenation, and ordering. Changes
Sequence Diagram(s)sequenceDiagram
participant P as Parser
participant F as ArrayAgg/StringAgg (Function)
participant D as DistinctableTrait
participant O as OrderableTrait
P->>F: parse(Parser)
F->>D: parseDistinctClause(Parser)
D-->>F: Set isDistinct flag
F->>O: parseOrderByClause(Parser)
O-->>F: Process ORDER BY clause
F->>F: Customize function parameters
F->>P: Return parsed structure with DISTINCT & ORDER BY info
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (6)
🧰 Additional context used📓 Path-based instructions (1)`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php`: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL que...
🧠 Learnings (1)src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAgg.php (1)🧬 Code Definitions (4)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAggTest.php (1)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/StringAggTest.php (1)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/StringAgg.php (4)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAgg.php (2)
⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (21)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Summary by CodeRabbit
New Features
Refactor
Tests