opensearch-project / opensearch-project/sql
[BUG] Cannot pushdown a nested root as group-by key
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 176
- Forks
- 229
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
Query Information
PPL Command/Query:
source=test | stats count() by rec
source=test | top rec
source=test | dedup rec
Dataset Information
Dataset/Schema Type
- OpenTelemetry (OTEL)
- Simple Schema for Observability (SS4O)
- Open Cybersecurity Schema Framework (OCSF)
- Custom (details below)
Index Mapping
{
"mappings": {
"properties": {
"rec": {
"type": "nested",
"properties": {
"inner": {
"type": "integer"
}
}
}
}
}
}
Sample Data
{"rec":{"inner": 100}}
{"rec":{"inner": 101}}
{"rec":{"inner": 101}}
Bug Description
Issue Summary:
The queries above will try to trigger an aggregation pushdown which the group-by key (bucket) is rec. Since rec is a nested root, OpenSeach DSL returns null if the bucket fields is a nested field. So it will fallback to execute in Calcite EnumerableAggregate which may have performance issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the three PPL queries and the nested mapping shown in the issue, then trace how aggregation pushdown handles the group-by key rec. Verify behavior against the OpenSearch DSL result and the Calcite EnumerableAggregate fallback. Done means nested-root grouping no longer produces an unusable pushdown result and the affected queries behave correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100