-
Notifications
You must be signed in to change notification settings - Fork 177
Pushdown case function in aggregations as range queries #4400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
…gregations Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
…rser Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
| // Push auto date span & case in group-by list into nested aggregations | ||
| Pair<Set<Integer>, AggregationBuilder> aggPushedAndAggBuilder = | ||
| createNestedAggregation(groupList, project, subBuilder, helper); | ||
| Set<Integer> aggPushed = aggPushedAndAggBuilder.getLeft(); | ||
| AggregationBuilder pushedAggBuilder = aggPushedAndAggBuilder.getRight(); | ||
| // The group-by list after removing pushed aggregations | ||
| groupList = groupList.stream().filter(i -> !aggPushed.contains(i)).toList(); | ||
| if (pushedAggBuilder != null) { | ||
| subBuilder = new Builder().addAggregator(pushedAggBuilder); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking] Should this part of code be put in the second branch of the below if for better readability? It should have structure like:
if (aggregate.getGroupSet().isEmpty()) {
// no group by
} else {
// Push auto date span & case in group-by list into nested aggregations
...
...
if (groupList.isEmpty()) {
// No composite aggregation at top-level
...
} else {
// Composite aggregation at top level
...
}
}
It works well with current code but performing useless operations on some empty collections for no-group-by.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! optimized the logic here
| } | ||
| } else if (bucket instanceof Range.Bucket) { | ||
| // return null so that an empty range will be filtered out | ||
| if (bucket.getDocCount() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this at the beginning of this method to skip meaningless operations in advance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include InternalAutoDateHistogram.Bucket here as well to skip empty bucket for auto_date_span.
And also remove the code
sql/opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/CalciteLogicalIndexScan.java
Lines 312 to 329 in 1e62fba
| if (aggregationBuilder.getLeft().size() == 1 | |
| && aggregationBuilder.getLeft().getFirst() | |
| instanceof AutoDateHistogramAggregationBuilder autoDateHistogram) { | |
| // If it's auto_date_histogram, filter the empty bucket by using the first aggregate metrics | |
| RexBuilder rexBuilder = getCluster().getRexBuilder(); | |
| Optional<AggregationBuilder> aggBuilderOpt = | |
| autoDateHistogram.getSubAggregations().stream().toList().stream().findFirst(); | |
| RexNode condition = | |
| aggBuilderOpt.isEmpty() || aggBuilderOpt.get() instanceof ValueCountAggregationBuilder | |
| ? rexBuilder.makeCall( | |
| SqlStdOperatorTable.GREATER_THAN, | |
| rexBuilder.makeInputRef(newScan, 1), | |
| rexBuilder.makeLiteral( | |
| 0, rexBuilder.getTypeFactory().createSqlType(SqlTypeName.INTEGER))) | |
| : rexBuilder.makeCall( | |
| SqlStdOperatorTable.IS_NOT_NULL, rexBuilder.makeInputRef(newScan, 1)); | |
| return LogicalFilter.create(newScan, condition); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored as suggested
| return null; | ||
| } | ||
| // the content of the range bucket is extracted with `r.put(name, bucket.getKey())` below | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be another else here? Otherwise it will put the bucket.getKey into the results for composite agg as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I used to put all contents in bucket.getKey to pass unit tests in a wrong way; corrected the behavior now.
| rows(39225.0, 1, "a30", "IL", "M"), | ||
| rows(48086.0, 1, "a30", "IN", "F")); | ||
|
|
||
| // 2.4 Composite (2 fields) - Range - Range - Metric (with count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test case for composite - auto_date_span - range - metric. Set bins to a big enough value like 100 to verify whether the empty buckets are filtered out properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test added
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
| // 1.1 Range - Metric | ||
| assertYamlEqualsJsonIgnoreId( | ||
| loadExpectedPlan("agg_range_metric_push.yaml"), | ||
| explainQueryToString( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should change to explainQueryYaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks for reminding!
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.19-dev 2.19-dev
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.19-dev
# Create a new branch
git switch --create backport/backport-4400-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 18ab4dc9a02589e4348d67fa4b38a66d27ad7f59
# Push it to GitHub
git push --set-upstream origin backport/backport-4400-to-2.19-dev
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.19-devThen, create a pull request where the |
…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)
…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)
…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
…ueries (#4400) (#4630) * Pushdown case function in aggregations as range queries (#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 * Downgrade langauge level to java 11 Signed-off-by: Yuanchun Shen <[email protected]> * Delete an IT due to system-incompatible formatting issue Signed-off-by: Yuanchun Shen <[email protected]> --------- Signed-off-by: Yuanchun Shen <[email protected]>
* default-main: (34 commits) Enhance dynamic source clause to support only metadata filters (opensearch-project#4554) Make nested alias type support referring to outer context (opensearch-project#4673) Update big5 ppl queries and check plans (opensearch-project#4668) Support push down sort after limit (opensearch-project#4657) Use table scan rowType in filter pushdown could fix rename issue (opensearch-project#4670) Fix: Support Alias Fields in MIN, MAX, FIRST, LAST, and TAKE Aggregations (opensearch-project#4621) Fix bin nested fields issue (opensearch-project#4606) Add `per_minute`, `per_hour`, `per_day` function support (opensearch-project#4531) Pushdown sort aggregate metrics (opensearch-project#4603) Followup: Change ComparableLinkedHashMap to compare Key than Value (opensearch-project#4648) Mitigate the CI failure caused by 500 Internal Server Error (opensearch-project#4646) Allow renaming group-by fields to existing field names (opensearch-project#4586) Publish internal modules separately for downstream reuse (opensearch-project#4484) Revert "Update grammar files and developer guide (opensearch-project#4301)" (opensearch-project#4643) Support Automatic Type Conversion for REX/SPATH/PARSE Command Extractions (opensearch-project#4599) Replace all dots in fields of table scan's PhysType (opensearch-project#4633) Return comparable LinkedHashMap in `valueForCalcite()` of ExprTupleValue (opensearch-project#4629) Refactor JsonExtractAllFunctionIT and MapConcatFunctionIT (opensearch-project#4623) Pushdown case function in aggregations as range queries (opensearch-project#4400) Update GEOIP function to support IP types as input (opensearch-project#4613) ... # Conflicts: # docs/user/ppl/functions/conversion.rst
* default-main: (34 commits) Enhance dynamic source clause to support only metadata filters (opensearch-project#4554) Make nested alias type support referring to outer context (opensearch-project#4673) Update big5 ppl queries and check plans (opensearch-project#4668) Support push down sort after limit (opensearch-project#4657) Use table scan rowType in filter pushdown could fix rename issue (opensearch-project#4670) Fix: Support Alias Fields in MIN, MAX, FIRST, LAST, and TAKE Aggregations (opensearch-project#4621) Fix bin nested fields issue (opensearch-project#4606) Add `per_minute`, `per_hour`, `per_day` function support (opensearch-project#4531) Pushdown sort aggregate metrics (opensearch-project#4603) Followup: Change ComparableLinkedHashMap to compare Key than Value (opensearch-project#4648) Mitigate the CI failure caused by 500 Internal Server Error (opensearch-project#4646) Allow renaming group-by fields to existing field names (opensearch-project#4586) Publish internal modules separately for downstream reuse (opensearch-project#4484) Revert "Update grammar files and developer guide (opensearch-project#4301)" (opensearch-project#4643) Support Automatic Type Conversion for REX/SPATH/PARSE Command Extractions (opensearch-project#4599) Replace all dots in fields of table scan's PhysType (opensearch-project#4633) Return comparable LinkedHashMap in `valueForCalcite()` of ExprTupleValue (opensearch-project#4629) Refactor JsonExtractAllFunctionIT and MapConcatFunctionIT (opensearch-project#4623) Pushdown case function in aggregations as range queries (opensearch-project#4400) Update GEOIP function to support IP types as input (opensearch-project#4613) ... Signed-off-by: Asif Bashar <[email protected]>
Description
This PR push down CASE functions used in aggregations as range queries.
For example, the query
source=bank | eval age_range = case (age < 30, 'u30', age < 40, 'u40' else 'u100') | stats avg(balance) by age_rangewill be pushed down as the following OpenSearch DSL:{ "aggregations": { "age_range": { "range": { "field": "age", "ranges": [ { "key": "u30", "to": 30 }, { "key": "u40", "from": 30, "to": 40 }, { "key": "u100", "from": 40 } ], "keyed": true }, "aggregations": { "avg(balance)": { "avg": { "field": "balance" } } } } } }A CASE function used in aggregation can be pushed down only if it satisfied the following criteria:
Limitations:
case(balance<10, 'poor' else 'rich')will be pushed down, whilecase(balance<10, 10 else 100)won't.nullvalues. E.g.eval b = case(balance<10, 'poor' else 'rich') | stats avg(balance) by bwill not properly handle cases when there are balance withnullvalues. Forcasefunction, null values be categorized into the else group; while with pushed-down aggregation, rows withnullbalance will be ignored.casefunction, the default else group isnull. However, sincenullcan not be a key for a range query, we substitute it with"null". This can be fixed later by assigning a secret key to the else group, and substituting it later when parsing the response.Examples of generated DSL
Case 1: Group by the case field only, with sub-aggregations
{ "aggregations": { "age_range": { "range": { "field": "age", "ranges": [ { "key": "u30", "to": 30 }, { "key": "u40", "from": 30, "to": 40 }, { "key": "u100", "from": 40 } ], "keyed": true }, "aggregations": { "avg(balance)": { "avg": { "field": "balance" } } } } } }Case 2: Group by multiple ranges with sub-aggregations
{ "aggregations": { "age_range": { "range": { "field": "age", "ranges": [ { "key": "u30", "to": 30 }, { "key": "u35", "from": 30, "to": 35 }, { "key": "u40", "from": 35, "to": 40 }, { "key": "u100", "from": 40 } ], "keyed": true }, "aggregations": { "balance_range": { "range": { "field": "balance", "ranges": [ { "key": "medium", "to": 20000 }, { "key": "high", "from": 20000 } ], "keyed": true }, "aggregations": { "avg(balance)": { "avg": { "field": "balance" } } } } } } } }Case 3: Group by case field and keyword field
{ "aggregations": { "composite_buckets": { "composite": { "size": 1000, "sources": [ { "firstname": { "terms": { "field": "firstname", "missing_bucket": true, "missing_order": "first", "order": "asc" } } }, { "lastname": { "terms": { "field": "lastname", "missing_bucket": true, "missing_order": "first", "order": "asc" } } } ] }, "aggregations": { "age_range": { "range": { "field": "age", "ranges": [ { "key": "u30", "to": 30 }, { "key": "u35", "from": 30, "to": 35 }, { "key": "u40", "from": 35, "to": 40 }, { "key": "u100", "from": 40 } ], "keyed": true }, "aggregations": { "avg(balance)": { "avg": { "field": "balance" } } } } } } } }TODOs:
Fix the discrepancy ofleft as a limitation.nullas expression results (in the pushed down version, it is"null"instead ofnull)nullvaluesAutoDataHistogramAggregation,RangeAggregationandCompositeAggregationRelated Issues
Resolves #4201 , partially resolves #4338
Check List
--signoffor-s.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.