Skip to content

[BUG] eventstats/streamstats reject window functions that grammar accepts #5168

Open

Description

@penghuo

Query Information

PPL Command/Query:

source=bounty-types | eventstats row_number() by str_field
source=bounty-types | streamstats rank() by int_field
source=bounty-types | eventstats dense_rank() by str_field

Expected Result:
Supported window functions should execute in eventstats/streamstats.

Actual Result:
Each query fails with HTTP 500 and Unexpected window function for row_number, rank, and dense_rank.

Dataset Information

Dataset/Schema Type

  • OpenTelemetry (OTEL)
  • Simple Schema for Observability (SS4O)
  • Open Cybersecurity Schema Framework (OCSF)
  • Custom (details below)

Index Mapping

{
  "mappings": {
    "properties": {
      "int_field": { "type": "integer" },
      "str_field": { "type": "keyword" }
    }
  }
}

Sample Data

[
  { "int_field": 42, "str_field": "alpha" },
  { "int_field": -1, "str_field": "alpha" },
  { "int_field": 0, "str_field": "beta" }
]

Bug Description

Issue Summary:
eventstats/streamstats rejects common window functions even though grammar accepts them.

Steps to Reproduce:

  1. Create index with int_field and str_field.
  2. Insert sample rows.
  3. Run each query above.
  4. Observe HTTP 500 Unexpected window function errors.

Impact:
Window-based analytics pipelines cannot run using these standard functions.

Activity

  1. added
    bug
    PPL
    on Feb 24, 2026
  2. added a commit that references this issue on Apr 1, 2026
    6da6999
  3. songkant-aws commented on Apr 8, 2026

    @songkant-aws
    Collaborator

    I just checked some other popular engine that adopts pipeline query language. They don't support such window functions as row_number(), rank(), dense_rank() and nth_value() for similar commands. It makes sense because those SQL compatible functions requires the ordering, otherwise it's meaningless. However, both eventstats and streamstats only has partition by semantics, no order by semantics.

    So could we make it non bug issue? Instead, we can mark it as error-experience to improve error message to not confuse users.

  4. added
    error-experience
    and removed
    bug
    on Apr 8, 2026
  5. gingeekrishna commented on Jun 30, 2026

    @gingeekrishna
    Contributor

    Per the discussion above, this has been relabeled as an error-experience improvement rather than a missing-feature bug — rank/dense_rank/nth_value need ORDER BY semantics that eventstats/streamstats don't have.

    Opened #5600 to improve the error message: instead of a bare "Unexpected window function: X", it now names the rejected function and lists the functions that are actually supported, so users get actionable guidance instead of a confusing error.

  6. added a commit that references this issue on Aug 30, 2026
    7bae499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLerror-experience

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions