Skip to content

Implement distinct selects#52

Merged
JulianVennen merged 9 commits intomasterfrom
select-distinct
Mar 19, 2026
Merged

Implement distinct selects#52
JulianVennen merged 9 commits intomasterfrom
select-distinct

Conversation

@JulianVennen
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for SELECT DISTINCT to the query model so callers can request de-duplicated select results, with SQL generation and test-driver execution coverage.

Changes:

  • Extend SelectQuery with a distinct() fluent setter and isDistinct() flag.
  • Update SQL generation to emit SELECT DISTINCT ... when requested.
  • Add/extend tests for DISTINCT behavior and SQL string generation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/tests/TestDriverTest.php Adds integration-style tests validating DISTINCT behavior via the test driver.
test/tests/SQLTest.php Adds a generator-level assertion for SELECT DISTINCT * ....
src/Query/SelectQuery.php Introduces the distinct flag and fluent API on SelectQuery.
src/Query/Generator/SQL.php Emits DISTINCT in generated SQL when SelectQuery::isDistinct() is true.
src/Driver/Test/TestTable.php Implements DISTINCT filtering in the in-memory test driver query execution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for SELECT DISTINCT to the query builder and ensures SQL generation and the in-memory test driver can execute distinct queries.

Changes:

  • Introduces a distinct flag on SelectQuery with distinct() / isDistinct() APIs.
  • Updates the SQL generator to emit SELECT DISTINCT ... for distinct select queries.
  • Adds test coverage for distinct behavior in both the SQL generator tests and the TestDriver integration tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Query/SelectQuery.php Adds distinct state + fluent API to mark a select query as distinct.
src/Query/Generator/SQL.php Emits DISTINCT in generated SELECT statements when requested.
src/Driver/Test/TestTable.php Attempts to implement distinct filtering in the in-memory test driver.
test/tests/SQLTest.php Verifies SQL generation for SELECT DISTINCT * ....
test/tests/TestDriverTest.php Adds integration tests for distinct results (including field-only distinct and null handling).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for SELECT DISTINCT to the query layer, ensuring SQL generation and the in-memory Test driver can represent distinct selects, and adds PHPUnit coverage for the new query behavior.

Changes:

  • Add a distinct flag + fluent API (distinct(), isDistinct()) to SelectQuery.
  • Extend the SQL generator to emit SELECT DISTINCT ....
  • Update the Test driver to attempt de-duplication for distinct selects and add tests covering distinct selection scenarios (including nulls and aliases).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/tests/TestDriverTest.php Adds new PHPUnit tests for distinct select behavior in the Test driver.
test/tests/SQLTest.php Adds SQL generation test for SELECT DISTINCT * ....
src/Query/SelectQuery.php Introduces distinct state and API on SelectQuery.
src/Query/Generator/SQL.php Emits DISTINCT after SELECT when enabled on the query.
src/Driver/Test/TestTable.php Implements distinct handling in the in-memory Test table query path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for SELECT DISTINCT to the query layer, ensuring SQL generation and the in-memory test driver can represent distinct selects, and expanding test coverage to validate expected distinct behavior.

Changes:

  • Extend SelectQuery with a distinct() flag and accessor (isDistinct()).
  • Update SQL generator to emit SELECT DISTINCT ... for distinct select queries.
  • Update the test driver and tests to exercise distinct selection semantics (including distinct-by-field and null handling).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Query/SelectQuery.php Adds distinct state + fluent setter/getter on SelectQuery.
src/Query/Generator/SQL.php Emits DISTINCT in generated SQL for SelectQuery.
src/Driver/Test/TestTable.php Implements DISTINCT handling in the in-memory test driver and adjusts ordering/limit application timing.
test/tests/SQLTest.php Adds SQL generation test for SELECT DISTINCT * ....
test/tests/TestDriverTest.php Adds test-driver coverage for distinct behavior (field distinct, limit interaction, nulls, alias, aggregates).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for SELECT DISTINCT to the query layer and ensures both SQL generation and the in-memory test driver handle distinct selects, with accompanying unit tests.

Changes:

  • Introduce a distinct flag and fluent API (SelectQuery::distinct() / isDistinct()).
  • Update SQL generator to emit SELECT DISTINCT ....
  • Extend the test driver to apply DISTINCT (for explicit field selections) and adjust ordering/limiting flow; add tests covering DISTINCT scenarios.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/tests/TestDriverTest.php Adds integration tests for DISTINCT behavior in the test driver (fields, limit, null handling, alias, aggregate+group).
test/tests/SQLTest.php Adds SQL string-generation test asserting SELECT DISTINCT * ....
src/Query/SelectQuery.php Adds distinct flag, constructor param, and distinct accessor/mutator.
src/Query/Generator/SQL.php Emits DISTINCT keyword for distinct select queries.
src/Driver/Test/TestTable.php Applies DISTINCT de-duplication (when fields are specified) and moves ordering/limit application after select processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@JulianVennen JulianVennen requested a review from matthi4s March 17, 2026 22:17
@JulianVennen JulianVennen merged commit e7654e4 into master Mar 19, 2026
3 checks passed
@JulianVennen JulianVennen deleted the select-distinct branch March 19, 2026 11:20
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.

3 participants