opensearch-project / opensearch-project/sql

[BUG] can't evaluate on aggregator: sum

Open
#3,855 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug SQL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

In the AWS OpenSearch, I have enabled the SQL plugin to use the SQL queries.

{
  "transient" : {
    "plugins.sql.enabled" : true
  }
}

I'm using the following query:

select `revenue` as `status`, sum(`_ingest.totalPrice`) as value, count(*) as count, date_format(receiptDate, 'y-MM') as aggDate, 'revenue' as type from revenues WHERE `_uid`='1234' and ((millis>=1706745600000 and millis<=1717199999999) or millis=-1) GROUP by `status`, aggDate

The above query is working fine and giving the correct results but sometimes the query failed with the following response:

{
  "error": {
    "details": "can't evaluate on aggregator: sum",
    "reason": "Invalid SQL query",
    "type": "ExpressionEvaluationException"
  },
  "status": 400
}

I have asked this already on SO about an years ago https://stackoverflow.com/questions/78556181/aws-opensearch-cant-evaluate-on-aggregator-sum

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 supplied SQL query through the AWS OpenSearch SQL plugin, comparing successful and failing executions of the sum aggregation. No source files or tests are named; trace the aggregation evaluation path for the reported "can't evaluate on aggregator: sum" response, and consider the issue done when the intermittent failure is understood and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.