-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DISCUSS] How do we define operation of unique in nGQL? #548
Comments
Regarding the understanding of sql, there are the following points:
|
Please DO NOT use Chinese punctuation |
Just as @steppenwolfyuetong mentioned, unique is same as distinct in SQL (so we might want to call it DISTINCT as well) DISTINCT is different from GROUP BY |
In SQL, But in nGQL, we have multiple data fetching statements (GO, MATCH, FIND...), so it makes sense to make
Since uniqueness is very a common feature used in the data fetching, we could add it to the data fetch statements, such as in the
Be noted, there could be only ONE column decorated with DISTINCT in the data fetching statements. If you want to distinct on a combination of multiple columns, you need to use |
Since the simple |
As far as I know from SQL, DISTINCT would only take effect when it is placed in front of all returned fields, or it will be a kind of syntax error. That means DISTINCT would work on row, not single column. If you tend to make DISTINCT a decoration of single column, you have to define what value should return.
And the
|
Given a second thought, I somewhat agree with @CPWstatic . It's hard to define the behaviour of If one wants to fetch results and to distinct by parts of columns, I think he should resort to variables, like
|
@CPWstatic I buy in your idea. Let's make DISTINCT apply to the entire row
Here we return all distinct combinations of [col1, col2, col3] |
The following should return syntax error
|
Co-authored-by: Sophie <[email protected]> Co-authored-by: Yichen Wang <[email protected]> Co-authored-by: Sophie <[email protected]>
If we seach the graph by using go sentence, we might get the same record in result. Sometimes we might need make the result uniqueness.
How do we define the difference between
unique
andgroup by
? Can we just treat them as the same?Subtask of #492
The text was updated successfully, but these errors were encountered: