Skip to content

Commit 6cc4a41

Browse files
authored
[Backport 2.19-dev] Prune old in operator push down rules (#4992) (#5000)
* Prune old in operator push down rules (#4992) * Fix NPE in AggregateAnalyzer Signed-off-by: Heng Qian <qianheng@amazon.com> * Try prune old in our optimization rules Signed-off-by: Heng Qian <qianheng@amazon.com> * Try prune old in our optimization rules Signed-off-by: Heng Qian <qianheng@amazon.com> * Support prune old for AggregateIndexScanRule Signed-off-by: Heng Qian <qianheng@amazon.com> * Merge main and refactor DedupPushdownRule Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix explain IT Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix explain IT Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix clickbench IT Signed-off-by: Heng Qian <qianheng@amazon.com> * SpotlessApply Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix dedup explain it Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix UT Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix UT Signed-off-by: Heng Qian <qianheng@amazon.com> * Address comments Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix after merging main Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com> (cherry picked from commit a7f238e) Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix compiling Signed-off-by: Heng Qian <qianheng@amazon.com> * Fix compiling Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com>
1 parent 2b43b8b commit 6cc4a41

110 files changed

Lines changed: 471 additions & 385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/main/java/org/opensearch/sql/calcite/plan/PPLAggGroupMergeRule.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.apache.calcite.plan.RelRule;
1616
import org.apache.calcite.rel.logical.LogicalAggregate;
1717
import org.apache.calcite.rel.logical.LogicalProject;
18+
import org.apache.calcite.rel.rules.SubstitutionRule;
1819
import org.apache.calcite.rex.RexCall;
1920
import org.apache.calcite.rex.RexInputRef;
2021
import org.apache.calcite.rex.RexNode;
@@ -27,6 +28,7 @@
2728
import org.apache.commons.lang3.tuple.Pair;
2829
import org.immutables.value.Value;
2930
import org.opensearch.sql.calcite.utils.CalciteUtils;
31+
import org.opensearch.sql.calcite.utils.PlanUtils;
3032

3133
/**
3234
* Planner rule that merge multiple agg group fields into a single one, on which all other group
@@ -41,7 +43,8 @@
4143
* these UDFs' output must have equivalent cardinality as `a`.
4244
*/
4345
@Value.Enclosing
44-
public class PPLAggGroupMergeRule extends RelRule<PPLAggGroupMergeRule.Config> {
46+
public class PPLAggGroupMergeRule extends RelRule<PPLAggGroupMergeRule.Config>
47+
implements SubstitutionRule {
4548

4649
/** Creates a OpenSearchAggregateConvertRule. */
4750
protected PPLAggGroupMergeRule(Config config) {
@@ -101,6 +104,7 @@ public void apply(RelOptRuleCall call, LogicalAggregate aggregate, LogicalProjec
101104
parentProjections.addAll(aggCallRefs);
102105
relBuilder.project(parentProjections);
103106
call.transformTo(relBuilder.build());
107+
PlanUtils.tryPruneRelNodes(call);
104108
}
105109

106110
/** Rule configuration. */

core/src/main/java/org/opensearch/sql/calcite/plan/PPLAggregateConvertRule.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.apache.calcite.rel.core.Project;
1818
import org.apache.calcite.rel.logical.LogicalAggregate;
1919
import org.apache.calcite.rel.logical.LogicalProject;
20+
import org.apache.calcite.rel.rules.SubstitutionRule;
2021
import org.apache.calcite.rex.RexBuilder;
2122
import org.apache.calcite.rex.RexCall;
2223
import org.apache.calcite.rex.RexInputRef;
@@ -28,6 +29,7 @@
2829
import org.apache.calcite.tools.RelBuilder;
2930
import org.apache.commons.lang3.tuple.Pair;
3031
import org.immutables.value.Value;
32+
import org.opensearch.sql.calcite.utils.PlanUtils;
3133

3234
/**
3335
* Planner rule that converts specific aggCall to a more efficient expressions, which includes:
@@ -45,8 +47,8 @@
4547
* <p>- AVG/MAX/MIN(FIELD [+|-|*|+|/] NUMBER) -> AVG/MAX/MIN(FIELD) [+|-|*|+|/] NUMBER
4648
*/
4749
@Value.Enclosing
48-
public class PPLAggregateConvertRule extends RelRule<PPLAggregateConvertRule.Config> {
49-
50+
public class PPLAggregateConvertRule extends RelRule<PPLAggregateConvertRule.Config>
51+
implements SubstitutionRule {
5052
/** Creates a OpenSearchAggregateConvertRule. */
5153
protected PPLAggregateConvertRule(Config config) {
5254
super(config);
@@ -97,6 +99,8 @@ public void apply(RelOptRuleCall call, LogicalAggregate aggregate, LogicalProjec
9799
return ref;
98100
})
99101
.collect(Collectors.toList());
102+
// Stop processing if there is no converted agg call args
103+
if (convertedAggCallArgs.isEmpty()) return;
100104
relBuilder.project(newChildProjects);
101105
RelNode newInput = relBuilder.peek();
102106

@@ -194,6 +198,7 @@ public void apply(RelOptRuleCall call, LogicalAggregate aggregate, LogicalProjec
194198
aliasMaybe(relBuilder, constructor.apply(relBuilder.peek()), name)));
195199
relBuilder.project(parentProjects);
196200
call.transformTo(relBuilder.build());
201+
PlanUtils.tryPruneRelNodes(call);
197202
}
198203

199204
interface OperatorConstructor {

core/src/main/java/org/opensearch/sql/calcite/utils/PlanUtils.java

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,28 @@
1010
import static org.apache.calcite.rex.RexWindowBounds.UNBOUNDED_PRECEDING;
1111
import static org.apache.calcite.rex.RexWindowBounds.following;
1212
import static org.apache.calcite.rex.RexWindowBounds.preceding;
13+
import static org.opensearch.sql.calcite.utils.OpenSearchTypeFactory.isTimeBasedType;
1314

1415
import com.google.common.collect.ImmutableList;
1516
import java.lang.reflect.Method;
1617
import java.util.ArrayList;
18+
import java.util.Arrays;
1719
import java.util.HashSet;
1820
import java.util.List;
1921
import java.util.Objects;
2022
import java.util.Set;
23+
import java.util.function.Function;
2124
import java.util.function.Predicate;
2225
import java.util.stream.Collectors;
2326
import javax.annotation.Nullable;
27+
import org.apache.calcite.plan.Convention;
28+
import org.apache.calcite.plan.RelOptRuleCall;
2429
import org.apache.calcite.plan.RelOptTable;
30+
import org.apache.calcite.plan.volcano.VolcanoPlanner;
2531
import org.apache.calcite.rel.RelHomogeneousShuttle;
2632
import org.apache.calcite.rel.RelNode;
2733
import org.apache.calcite.rel.RelShuttle;
34+
import org.apache.calcite.rel.core.Aggregate;
2835
import org.apache.calcite.rel.core.AggregateCall;
2936
import org.apache.calcite.rel.core.Project;
3037
import org.apache.calcite.rel.core.Sort;
@@ -41,6 +48,7 @@
4148
import org.apache.calcite.rex.RexLiteral;
4249
import org.apache.calcite.rex.RexNode;
4350
import org.apache.calcite.rex.RexOver;
51+
import org.apache.calcite.rex.RexSlot;
4452
import org.apache.calcite.rex.RexVisitorImpl;
4553
import org.apache.calcite.rex.RexWindow;
4654
import org.apache.calcite.rex.RexWindowBound;
@@ -674,4 +682,98 @@ private static boolean isNotNullOnRef(RexNode rex) {
674682
&& rex.isA(SqlKind.IS_NOT_NULL)
675683
&& ((RexCall) rex).getOperands().get(0) instanceof RexInputRef;
676684
}
685+
686+
Predicate<Aggregate> aggIgnoreNullBucket =
687+
agg ->
688+
agg.getHints().stream()
689+
.anyMatch(
690+
hint ->
691+
hint.hintName.equals("stats_args")
692+
&& hint.kvOptions.get(Argument.BUCKET_NULLABLE).equals("false"));
693+
694+
Predicate<Aggregate> maybeTimeSpanAgg =
695+
agg ->
696+
agg.getGroupSet().stream()
697+
.allMatch(
698+
group ->
699+
isTimeBasedType(
700+
agg.getInput().getRowType().getFieldList().get(group).getType()));
701+
702+
static boolean isTimeSpan(RexNode rex) {
703+
return rex instanceof RexCall
704+
&& rex.getKind() == SqlKind.OTHER_FUNCTION
705+
&& ((RexCall)rex).getOperator().getName().equalsIgnoreCase(BuiltinFunctionName.SPAN.name())
706+
&& ((RexCall)rex).getOperands().size() == 3
707+
&& ((RexCall)rex).getOperands().get(2) instanceof RexLiteral
708+
&& ((RexLiteral)((RexCall)rex).getOperands().get(2)).getTypeName() != SqlTypeName.NULL;
709+
}
710+
711+
/**
712+
* Check if the condition is NOT NULL derived from an aggregate.
713+
*
714+
* @param condition the condition to check, composite of single or multiple NOT NULL conditions
715+
* @param aggregate the aggregate where the condition is derived from
716+
* @param project the project between the aggregate and the filter
717+
* @param otherMapping the other mapping generated from ProjectIndexScanRule when applied on the
718+
* above project with non-ref expressions.
719+
* @return true if the condition is single or multiple NOT NULL derived from an aggregate, false
720+
* otherwise
721+
*/
722+
static boolean isNotNullDerivedFromAgg(
723+
RexNode condition,
724+
Aggregate aggregate,
725+
@Nullable Project project,
726+
@Nullable List<Integer> otherMapping) {
727+
boolean ignoreNullBucket = aggIgnoreNullBucket.test(aggregate);
728+
if (!ignoreNullBucket && project == null) return false;
729+
List<Integer> groupRefList = aggregate.getGroupSet().asList();
730+
if (project != null) {
731+
groupRefList =
732+
groupRefList.stream()
733+
.map(project.getProjects()::get)
734+
.filter(rex -> ignoreNullBucket || isTimeSpan(rex))
735+
.flatMap(expr -> PlanUtils.getInputRefs(expr).stream())
736+
.map(RexSlot::getIndex)
737+
.collect(Collectors.toList());
738+
}
739+
if (otherMapping != null) {
740+
groupRefList = groupRefList.stream().map(otherMapping::get).collect(Collectors.toList());
741+
}
742+
List<Integer> finalGroupRefList = groupRefList;
743+
Function<RexNode, Boolean> isNotNullFromAgg =
744+
rex ->
745+
rex instanceof RexCall
746+
&& rex.isA(SqlKind.IS_NOT_NULL)
747+
&& ((RexCall)rex).getOperands().get(0) instanceof RexInputRef
748+
&& finalGroupRefList.contains(((RexInputRef)((RexCall)rex).getOperands().get(0)).getIndex());
749+
return isNotNullFromAgg.apply(condition)
750+
|| (condition instanceof RexCall
751+
&& ((RexCall)condition).getOperator() == SqlStdOperatorTable.AND
752+
&& ((RexCall)condition).getOperands().stream().allMatch(isNotNullFromAgg::apply));
753+
}
754+
755+
/**
756+
* Try to prune all RelNodes in the RuleCall from top to down. We can prune a RelNode if:
757+
*
758+
* <p>1. It's the root RelNode of the current RuleCall. Or,
759+
*
760+
* <p>2. It's logical RelNode and it only has one parent which is pruned. TODO: To be more
761+
* precisely, we can prun a RelNode whose parents are all pruned, but `prunedNodes` in
762+
* VolcanoPlanner is not available.
763+
*
764+
* @param call the RuleCall to prune
765+
*/
766+
static void tryPruneRelNodes(RelOptRuleCall call) {
767+
if (call.getPlanner() instanceof VolcanoPlanner) {
768+
VolcanoPlanner volcanoPlanner = (VolcanoPlanner) call.getPlanner();
769+
Arrays.stream(call.rels)
770+
.takeWhile(
771+
rel ->
772+
// Don't prune the physical RelNode as it may prevent sort expr push down
773+
rel.getConvention() == Convention.NONE
774+
&& (rel == call.rels[0]
775+
|| volcanoPlanner.getSubsetNonNull(rel).getParentRels().size() == 1))
776+
.forEach(volcanoPlanner::prune);
777+
}
778+
}
677779
}

integ-test/src/test/resources/expectedOutput/calcite/agg_composite_date_range_push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ calcite:
88
LogicalProject(@timestamp=[$0], category=[$1], value=[$2], timestamp=[$3], _id=[$4], _index=[$5], _score=[$6], _maxscore=[$7], _sort=[$8], _routing=[$9], value_range=[CASE(<($2, 7000), 'small':VARCHAR, 'large':VARCHAR)])
99
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data]])
1010
physical: |
11-
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data]], PushDownContext=[[FILTER->IS NOT NULL($0), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 2},avg(value)=AVG($1)), PROJECT->[avg(value), span(@timestamp,1h), value_range], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"@timestamp","boost":1.0}},"aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"span(@timestamp,1h)":{"date_histogram":{"field":"@timestamp","missing_bucket":false,"order":"asc","fixed_interval":"1h"}}}]},"aggregations":{"value_range":{"range":{"field":"value","ranges":[{"key":"small","to":7000.0},{"key":"large","from":7000.0}],"keyed":true},"aggregations":{"avg(value)":{"avg":{"field":"value"}}}}}}}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])
11+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data]], PushDownContext=[[AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 2},avg(value)=AVG($1)), PROJECT->[avg(value), span(@timestamp,1h), value_range], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"span(@timestamp,1h)":{"date_histogram":{"field":"@timestamp","missing_bucket":false,"order":"asc","fixed_interval":"1h"}}}]},"aggregations":{"value_range":{"range":{"field":"value","ranges":[{"key":"small","to":7000.0},{"key":"large","from":7000.0}],"keyed":true},"aggregations":{"avg(value)":{"avg":{"field":"value"}}}}}}}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])

integ-test/src/test/resources/expectedOutput/calcite/big5/cardinality_agg_high.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ calcite:
66
LogicalFilter(condition=[IS NOT NULL($3)])
77
CalciteLogicalIndexScan(table=[[OpenSearch, big5]])
88
physical: |
9-
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($3), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`agent.name`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"agent.name","boost":1.0}},"aggregations":{"dc(`agent.name`)":{"cardinality":{"field":"agent.name"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
9+
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($0), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`agent.name`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"agent.name","boost":1.0}},"aggregations":{"dc(`agent.name`)":{"cardinality":{"field":"agent.name"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])

integ-test/src/test/resources/expectedOutput/calcite/big5/cardinality_agg_high_2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ calcite:
66
LogicalFilter(condition=[IS NOT NULL($37)])
77
CalciteLogicalIndexScan(table=[[OpenSearch, big5]])
88
physical: |
9-
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($37), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`event.id`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"event.id","boost":1.0}},"aggregations":{"dc(`event.id`)":{"cardinality":{"field":"event.id"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
9+
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($0), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`event.id`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"event.id","boost":1.0}},"aggregations":{"dc(`event.id`)":{"cardinality":{"field":"event.id"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])

integ-test/src/test/resources/expectedOutput/calcite/big5/cardinality_agg_low.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ calcite:
66
LogicalFilter(condition=[IS NOT NULL($14)])
77
CalciteLogicalIndexScan(table=[[OpenSearch, big5]])
88
physical: |
9-
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($14), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`cloud.region`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"cloud.region","boost":1.0}},"aggregations":{"dc(`cloud.region`)":{"cardinality":{"field":"cloud.region"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
9+
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->IS NOT NULL($0), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={},dc(`cloud.region`)=COUNT(DISTINCT $0)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"exists":{"field":"cloud.region","boost":1.0}},"aggregations":{"dc(`cloud.region`)":{"cardinality":{"field":"cloud.region"}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])

integ-test/src/test/resources/expectedOutput/calcite/big5/composite_date_histogram_daily.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ calcite:
88
LogicalFilter(condition=[AND(>=($17, TIMESTAMP('2022-12-30 00:00:00':VARCHAR)), <($17, TIMESTAMP('2023-01-07 12:00:00':VARCHAR)))])
99
CalciteLogicalIndexScan(table=[[OpenSearch, big5]])
1010
physical: |
11-
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[PROJECT->[@timestamp], FILTER->SEARCH($0, Sarg[['2022-12-30 00:00:00':VARCHAR..'2023-01-07 12:00:00':VARCHAR)]:VARCHAR), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0},count()=COUNT()), PROJECT->[count(), span(`@timestamp`,1d)], LIMIT->10, LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"range":{"@timestamp":{"from":"2022-12-30T00:00:00.000Z","to":"2023-01-07T12:00:00.000Z","include_lower":true,"include_upper":false,"format":"date_time","boost":1.0}}},"_source":{"includes":["@timestamp"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":10,"sources":[{"span(`@timestamp`,1d)":{"date_histogram":{"field":"@timestamp","missing_bucket":false,"order":"asc","fixed_interval":"1d"}}}]}}}}, requestedTotalSize=10, pageSize=null, startFrom=0)])
11+
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->SEARCH($0, Sarg[['2022-12-30 00:00:00':VARCHAR..'2023-01-07 12:00:00':VARCHAR)]:VARCHAR), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0},count()=COUNT()), PROJECT->[count(), span(`@timestamp`,1d)], LIMIT->10, LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"range":{"@timestamp":{"from":"2022-12-30T00:00:00.000Z","to":"2023-01-07T12:00:00.000Z","include_lower":true,"include_upper":false,"format":"date_time","boost":1.0}}},"aggregations":{"composite_buckets":{"composite":{"size":10,"sources":[{"span(`@timestamp`,1d)":{"date_histogram":{"field":"@timestamp","missing_bucket":false,"order":"asc","fixed_interval":"1d"}}}]}}}}, requestedTotalSize=10, pageSize=null, startFrom=0)])

integ-test/src/test/resources/expectedOutput/calcite/big5/composite_terms.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ calcite:
88
LogicalFilter(condition=[AND(>=($17, TIMESTAMP('2023-01-02 00:00:00':VARCHAR)), <($17, TIMESTAMP('2023-01-02 10:00:00':VARCHAR)), IS NOT NULL($7), IS NOT NULL($14))])
99
CalciteLogicalIndexScan(table=[[OpenSearch, big5]])
1010
physical: |
11-
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[PROJECT->[process.name, cloud.region, @timestamp], FILTER->AND(SEARCH($2, Sarg[['2023-01-02 00:00:00':VARCHAR..'2023-01-02 10:00:00':VARCHAR)]:VARCHAR), IS NOT NULL($0), IS NOT NULL($1)), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},count()=COUNT()), PROJECT->[count(), process.name, cloud.region], SORT->[1 DESC LAST, 2 ASC FIRST], LIMIT->10, LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"must":[{"range":{"@timestamp":{"from":"2023-01-02T00:00:00.000Z","to":"2023-01-02T10:00:00.000Z","include_lower":true,"include_upper":false,"format":"date_time","boost":1.0}}},{"exists":{"field":"process.name","boost":1.0}},{"exists":{"field":"cloud.region","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["process.name","cloud.region","@timestamp"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":10,"sources":[{"process.name":{"terms":{"field":"process.name","missing_bucket":false,"order":"desc"}}},{"cloud.region":{"terms":{"field":"cloud.region","missing_bucket":false,"order":"asc"}}}]}}}}, requestedTotalSize=10, pageSize=null, startFrom=0)])
11+
CalciteEnumerableIndexScan(table=[[OpenSearch, big5]], PushDownContext=[[FILTER->AND(SEARCH($2, Sarg[['2023-01-02 00:00:00':VARCHAR..'2023-01-02 10:00:00':VARCHAR)]:VARCHAR), IS NOT NULL($0), IS NOT NULL($1)), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},count()=COUNT()), PROJECT->[count(), process.name, cloud.region], SORT->[1 DESC LAST, 2 ASC FIRST], LIMIT->10, LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"must":[{"range":{"@timestamp":{"from":"2023-01-02T00:00:00.000Z","to":"2023-01-02T10:00:00.000Z","include_lower":true,"include_upper":false,"format":"date_time","boost":1.0}}},{"exists":{"field":"process.name","boost":1.0}},{"exists":{"field":"cloud.region","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"aggregations":{"composite_buckets":{"composite":{"size":10,"sources":[{"process.name":{"terms":{"field":"process.name","missing_bucket":false,"order":"desc"}}},{"cloud.region":{"terms":{"field":"cloud.region","missing_bucket":false,"order":"asc"}}}]}}}}, requestedTotalSize=10, pageSize=null, startFrom=0)])

0 commit comments

Comments
 (0)