-
Couldn't load subscription status.
- Fork 705
sql: improve aggregation docs #657
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
Incorrectly stated only-full-group-by was not supported.
sql/aggregate-group-by-functions.md
Outdated
| | [`STDDEV_SAMP()`](https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_stddev-samp) | Return the sample standard deviation | | ||
| | [`VARIANCE()`](https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_variance) | Return the population standard variance | | ||
| | [`VAR_POP()`](https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_var-pop) | Return the population standard variance | | ||
| | [`JSON_ARRAYAGG()`](https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_json-arrayagg) | Return result set as a single JSON array | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these functions are not supported yet, their PRs are in review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment in the description- I will move them to ‘unsupported’ if they do not merge before review of this PR is complete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR to only include merged functions. PTAL @zz-jason
sql/aggregate-group-by-functions.md
Outdated
| ## GROUP BY modifiers | ||
|
|
||
| TiDB dose not support any `GROUP BY` modifiers currently. We'll do it in the future. For more information, see [#4250](https://github.com/pingcap/tidb/issues/4250). | ||
| TiDB does not currently support `GROUP BY` modifiers such as `WITH ROLLUP`. We plan to add support in the future. See [TIDB #4250](https://github.com/pingcap/tidb/issues/4250). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sql/aggregate-group-by-functions.md
Outdated
| TiDB performs equivalent to MySQL with sql mode [`ONLY_FULL_GROUP_BY`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by) being disabled: permits the `SELECT` list, `HAVING` condition, or `ORDER BY` list to refer to non-aggregated columns even if the columns are not functionally dependent on `GROUP BY` columns. | ||
|
|
||
| For example, this query is illegal in MySQL 5.7.5 with `ONLY_FULL_GROUP_BY` enabled because the non-aggregated column "b" in the `SELECT` list does not appear in the `GROUP BY`: | ||
| TiDB supports the SQL Mode `ONLY_FULL_GROUP_BY`, and when enabled TiDB will refuse queries with ambiguous non-aggregated columns. For example, this query is illegal with `ONLY_FULL_GROUP_BY` enabled because the non-aggregated column "b" in the `SELECT` list does not appear in the `GROUP BY`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the GROUP BY -> the GROUP BY statement
OR:
the GROUP BY -> the GROUP BY
sql/aggregate-group-by-functions.md
Outdated
| ``` | ||
|
|
||
| The preceding query is legal in TiDB. TiDB does not support SQL mode `ONLY_FULL_GROUP_BY` currently. We'll do it in the future. For more inmormation, see [#4248](https://github.com/pingcap/tidb/issues/4248). | ||
| TiDB does not currently enable [`ONLY_FULL_GROUP_BY`](mysql-compatibility.md#default-differences) mode by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable -> enable the ... mode
sql/aggregate-group-by-functions.md
Outdated
|
|
||
| ### Differences from MySQL | ||
|
|
||
| The current implementation of `ONLY_FULL_GROUP_BY` is less strict than in MySQL 5.7. For example, suppose that we execute the following query, expecting the results to be ordered by "c": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than in MySQL -> than that in MySQL
sql/aggregate-group-by-functions.md
Outdated
| ## Detection of functional dependence | ||
| ## Unsupported aggregate functions | ||
|
|
||
| The following aggregate functions are currently unsupported in TiDB. You can track our progress in [TIDB #7623](https://github.com/pingcap/tidb/issues/7623): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Remove one extra space before "You can". Only leave one.
- TIDB 7623 -> TiDB 7623
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
I've removed the yet-to-be-merged functions, so it is easier to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Incorrectly stated only-full-group-by was not supported.
Note: This PR references aggregate functions that are in development and have not been merged yet. If they are not complete after review, I will move them to the unsupported functions section.