Skip to content

feat: support distinctrow keyword #2238

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EmilyOng
Copy link
Contributor

This PR adds support for the DISTINCTROW keyword available in MySQL and MariaDB.

SELECT
    [ALL | DISTINCT | DISTINCTROW ]
    ....
    select_expr [, select_expr]
...

@@ -43,9 +44,18 @@ public void setUseUnique(boolean useUnique) {
this.useUnique = useUnique;
}

public boolean isUseDistinctRow() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since DISTINCTROW is a synonym for DISTINCT, I re-used the existing Distinct class and only augmented it with the useDistinctRow attribute to determine the string representation of Distinct.

@@ -3027,6 +3028,8 @@ PlainSelect PlainSelect() #PlainSelect:
[ LOOKAHEAD(2) "ON" "(" distinctOn=SelectItemsList() { plainSelect.getDistinct().setOnSelectItems(distinctOn); } ")" ]
)
|
<K_DISTINCTROW> { Distinct distinct = new Distinct(); distinct.setUseDistinctRow(true); plainSelect.setDistinct(distinct); }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is separate from the <K_DISTINCT> case right above, because DISTINCT ON or DISTINCTROW ON is not applicable in MySQL.

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