Skip to content
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

Add support for stats aggregate function #99

Closed
dai-chen opened this issue May 27, 2021 · 2 comments · Fixed by #108
Closed

Add support for stats aggregate function #99

dai-chen opened this issue May 27, 2021 · 2 comments · Fixed by #108
Assignees
Labels
enhancement New feature or request PPL Piped processing language SQL

Comments

@dai-chen
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently stats aggregate function support is missing in both SQL and PPL.

Describe the solution you'd like
Add support for the following stats aggregate function in SQL. MySQL reference: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_std

1.STD
2.STDDEV
3.STDDEV_POP
4.STDDEV_SAMP
5.VAR_POP
6.VAR_SAMP
7.VARIANCE

PPL also needs to support some of them. Reference: https://docs.splunk.com/Documentation/SCS/current/SearchReference/Aggregatefunctions#stdev.28.26lt.3Bvalue.26gt.3B.29

Note that these functions may be optimized by pushing down to OpenSearch stats/extended_stats aggregation API: https://docs-beta.opensearch.org/docs/opensearch/metric-agg/#stats-extended_stats-matrix_stats. This can be part of #44 so this task can focus on basic implementation without pushdown.

Describe alternatives you've considered
N/A

@dai-chen dai-chen added enhancement New feature or request SQL PPL Piped processing language Priority-Medium labels May 27, 2021
@penghuo
Copy link
Collaborator

penghuo commented Jun 2, 2021

SQL Requirements

Refer https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_std。

  • STD(expr) is a synonym for the standard SQL function STDDEV_POP().
  • STDDEV(expr) is a synonym for the standard SQL function STDDEV_POP().
  • STDDEV_POP(expr) is the square root of VAR_POP().
  • STDDEV_SAMP(expr) is the squre root of VAR_SAMP().
  • VARIANCE(expr) is a synonym for the standard SQL function VAR_POP(),
  • VAR_POP(expr)
  • VAR_SAMP(expr)

PPL Requirements

Refer https://docs.splunk.com/Documentation/SCS/current/SearchReference/Aggregatefunctions#stdev.28.26lt.3Bvalue.26gt.3B.29

  • stddev(expr), This function returns the sample standard deviation of the values in a field. Similar to STDDEV_SAMP() in SQL.
  • stddevp(expr), This function returns the population standard deviation of the values in a field. Similar to STDDEV_POP() in SQL.
  • var(expr), Similar to VAR_SAMP() in SQL.
  • varp(expr), Similar to VAR_POP() in SQL.

@penghuo
Copy link
Collaborator

penghuo commented Jun 4, 2021

Task breakdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PPL Piped processing language SQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants