Skip to content

Conversation

@yuancu
Copy link
Collaborator

@yuancu yuancu commented Oct 22, 2025

Description

Backport #4400 to 2.19-dev

Commit Message

  • WIP: implementing case range analyzer

  • Correct case analyzer

  • Create bucket aggregation parsers that supports parsing nested sub aggregations

  • Fix unit tests

  • Fix parsers to multi-range cases

  • Update leaf bucket parser

  • Unit test case range analyzer

  • Add explain ITs for pushing down case in aggregations

  • Update CaseRangeAnalyzerTest

  • Add a yaml test that replicates issue 4201

  • Add integration tests for case in aggregation

  • Fix unit tests

  • Add a patch to CalcitePPLCaseFunctionIT

  • Migrate all composite aggregation parser usage to bucket aggregate parser

  • Create a parent abstract classes for BucketAggregationParsers

  • Remove an unnecessary bucket agg in AggregationQueryBuilder

  • Test pushing down case where there exists null values

  • Return empty in CaseRangeAnalyzer to unblock the rest pushdown

  • Additionally test number as result expressions
  • Document limitations of pushding case as range queries

  • Make case pushdown a private method

  • Chores: remove unused helper method

  • Unify logics for creating nested aggregations

  • Remove a note in condition.rst

  • Optmize range aggregation

  • Ignore testNestedAggregationsExplain when pushdown is disabled

  • Fix explain ITs after merge


(cherry picked from commit 18ab4dc)

Related Issues

Resolves #4201

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@yuancu yuancu force-pushed the backport/backport-4400-to-2.19-dev branch 2 times, most recently from 4db1fe1 to 6e9fd4f Compare October 22, 2025 09:05
…roject#4400)

* WIP: implementing case range analyzer

Signed-off-by: Yuanchun Shen <[email protected]>

* Correct case analyzer

Signed-off-by: Yuanchun Shen <[email protected]>

* Create bucket aggregation parsers that supports parsing nested sub aggregations

Signed-off-by: Yuanchun Shen <[email protected]>

* Fix unit tests

Signed-off-by: Yuanchun Shen <[email protected]>

* Fix parsers to multi-range cases

Signed-off-by: Yuanchun Shen <[email protected]>

* Update leaf bucket parser

Signed-off-by: Yuanchun Shen <[email protected]>

* Unit test case range analyzer

Signed-off-by: Yuanchun Shen <[email protected]>

* Add explain ITs for pushing down case in aggregations

Signed-off-by: Yuanchun Shen <[email protected]>

* Update CaseRangeAnalyzerTest

Signed-off-by: Yuanchun Shen <[email protected]>

* Add a yaml test that replicates issue 4201

Signed-off-by: Yuanchun Shen <[email protected]>

* Add integration tests for case in aggregation

Signed-off-by: Yuanchun Shen <[email protected]>

* Fix unit tests

Signed-off-by: Yuanchun Shen <[email protected]>

* Add a patch to CalcitePPLCaseFunctionIT

Signed-off-by: Yuanchun Shen <[email protected]>

* Migrate all composite aggregation parser usage to bucket aggregate parser

Signed-off-by: Yuanchun Shen <[email protected]>

* Create a parent abstract classes for BucketAggregationParsers

Signed-off-by: Yuanchun Shen <[email protected]>

* Remove an unnecessary bucket agg in AggregationQueryBuilder

Signed-off-by: Yuanchun Shen <[email protected]>

* Test pushing down case where there exists null values

Signed-off-by: Yuanchun Shen <[email protected]>

* Return empty in CaseRangeAnalyzer to unblock the rest pushdown
- Additionally test number as result expressions

Signed-off-by: Yuanchun Shen <[email protected]>

* Document limitations of pushding case as range queries

Signed-off-by: Yuanchun Shen <[email protected]>

* Make case pushdown a private method

Signed-off-by: Yuanchun Shen <[email protected]>

* Chores: remove unused helper method

Signed-off-by: Yuanchun Shen <[email protected]>

* Unify logics for creating nested aggregations

Signed-off-by: Yuanchun Shen <[email protected]>

* Remove a note in condition.rst

Signed-off-by: Yuanchun Shen <[email protected]>

* Optmize range aggregation

Signed-off-by: Yuanchun Shen <[email protected]>

* Ignore testNestedAggregationsExplain when pushdown is disabled

Signed-off-by: Yuanchun Shen <[email protected]>

* Fix explain ITs after merge

Signed-off-by: Yuanchun Shen <[email protected]>

---------

Signed-off-by: Yuanchun Shen <[email protected]>
(cherry picked from commit 18ab4dc)

# Conflicts:
#	integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java
@yuancu yuancu force-pushed the backport/backport-4400-to-2.19-dev branch from 6e9fd4f to 79e2326 Compare October 24, 2025 02:16
@qianheng-aws qianheng-aws merged commit b116dd6 into opensearch-project:2.19-dev Oct 24, 2025
69 of 70 checks passed
@yuancu yuancu deleted the backport/backport-4400-to-2.19-dev branch October 24, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants