Skip to content

ESQL: Functions! #98545

@nik9000

Description

@nik9000

Description

Description

This is a list of "shovel ready" functions. It's functions we are fairly sure we want and we should be able to start working on them now. This list is not sorted at all, partly because making any one of these functions shouldn't be a huge effort so the cost of having a sorted list is comparatively high.

This list is not sacred. If you need a function to do something, stick it on the list. Maybe even build it yourself, it's fun!

Weird

  • TYPEOF
    • A constant string returning the type of the column?

IP

  • AUTO_BUCKET for IPs
  • MASK (called IP_PREFIX)

Math

String

Date

  • DAY_NAME/DAYNAME Add ESQL DAY_NAME function #132535
  • MONTH_NAME/MONTHNAME
  • DATE_ADD/DATEADD/TIMESTAMP_ADD/TIMESTAMPADD (surogate: binary operators with time periods)
  • DATE_DIFF/DATEDIFF/TIMESTAMP_DIFF/TIMESTAMPDIFF
  • DATE_PART/DATEPART for now folks can use EXTRACT
  • DAY_OF_MONTH/DOM/DAY for now folks can use EXTRACT
  • DAY_OF_WEEK/DAYOFWEEK/DOW for now folks can use EXTRACT
  • DAY_OF_YEAR/DOY for now folks can use EXTRACT
  • EXTRACT (DATE_EXTRACT)
  • HOUR_OF_DAY/HOUR for now folks can use EXTRACT
  • ISO_DAY_OF_WEEK/ISODAYOFWEEK/ISODOW/IDOW for now folks can use EXTRACT
  • ISO_WEEK_OF_YEAR/ISOWEEKOFYEAR/ISOWEEK/IWOY/IW for now folks can use EXTRACT
  • MINUTE_OF_DAY for now folks can use EXTRACT
  • MINUTE_OF_HOUR/MINUTE for now folks can use EXTRACT
  • MONTH_OF_YEAR/MONTH for now folks can use EXTRACT
  • SECOND_OF_MINUTE/SECOND for now folks can use EXTRACT
  • QUARTER for now folks can use EXTRACT
  • WEEK_OF_YEAR/WEEK for now folks can use EXTRACT
  • YEAR for now folks can use EXTRACT

Multi-valued

Encode/Decode

  • CHARSET
    • Converts binary data form one charset to another. CHARSET(bytes field, source charset, target charset (optional - default could be UTF-8))
    • UTF-8 bytes fields have the same data as keyword fields. We should make there be a nice way to convert. Shouldn't need copies.
    • We don't have a bytes data type in ESQL yet.
  • FROM_/TO_BASE64#107135
  • URL_ENCODE/URL_DECODE

Secure Hashing

  • , SHAKE_128, SHAKE_256 (they are not available using MessageDigest)
  • MD5, SHA1, SHA256
  • implement more hash function aliases (if needed), such as: SHA_0, SHA_1, SHA_256, SHA_512. Currently they are available using hash(.., ..)
  • GENERIC SECURE_HASH() by relying on the underlying MessageDigest.getInstance

Aggregate (STATS ... BY)

  • CORR(x,y) - correlation coefficient
  • COVAR_POP(x,y) - population covariance (without bias correction)
  • COVAR_SAMPL(x,y) - sample covariance (with Bessel's bias correction)
  • ENTROPY(x) - Shannon/log-2 entropy
  • KURTOSIS(x) - excess kurtosis (Fisher's definition?) with bias from on sample size
  • KURTOSIS_POP(x) - excess kurtosis (Fisher's definition?) population without bias
  • PERCENTILE_RANK(x) - ranking variant for percentile
  • SKEWNESS(x)
  • STDEV [ES|QL] Add a standard deviation function #116531 (uses Welford's algorithm - population? )
  • STDDEV_POP - population variation for stddev @limotova
  • STDDEV_SAMP- sampling variation for stddev @limotova
  • VAR_POP(x) - population variance @limotova
  • VAR_SAMP(X) - sample variance @limotova

NULL

Score functions

Miscellaneous functions

  • FORMAT / PRINT output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions