opensearch-project / opensearch-project/sql

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

Open
#5,168 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

error-experience PPL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the three PPL queries against the sample mapping and data, then trace the eventstats/streamstats handling that emits Unexpected window function. Done means row_number(), rank(), and dense_rank() execute successfully in both commands without HTTP 500 errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.