Skip to content

Add support for stats aggregate function #99

Closed

Description

@dai-chen

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

Activity

  1. added
    enhancement
    PPL
    on May 27, 2021
  2. penghuo commented on Jun 2, 2021

    @penghuo
    Collaborator

    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.
  3. penghuo commented on Jun 4, 2021

    @penghuo
    Collaborator

    Task breakdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLSQLenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions