@@ -2,35 +2,31 @@ calcite:
22 logical : |
33 LogicalSystemLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[10000], type=[QUERY_SIZE_LIMIT])
44 LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])
5- LogicalAggregate(group=[{0, 1}], avg(balance )=[AVG ($2)])
6- LogicalProject(gender =[$0], age =[CASE(IS NULL($1), 'NULL':VARCHAR, <=($5, 10), $1, 'OTHER':VARCHAR)], avg(balance )=[$2])
5+ LogicalAggregate(group=[{0, 1}], max(value )=[MAX ($2)])
6+ LogicalProject(timestamp =[$0], category =[CASE(IS NULL($1), 'NULL':VARCHAR, <=($5, 10), $1, 'OTHER':VARCHAR)], max(value )=[$2])
77 LogicalJoin(condition=[=($1, $3)], joinType=[left])
8- LogicalProject(gender =[$0 ], age=[SAFE_CAST($1) ], avg(balance )=[$2])
9- LogicalAggregate(group=[{0, 1}], avg(balance )=[AVG ($2)])
10- LogicalProject(gender =[$4 ], age=[$10 ], balance =[$7 ])
11- LogicalFilter(condition=[AND(IS NOT NULL($4 ), IS NOT NULL($7 ))])
12- CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank ]])
13- LogicalProject(age =[$0], __grand_total__=[$1], _row_number_chart_=[ROW_NUMBER() OVER (ORDER BY $1 DESC NULLS LAST)])
8+ LogicalProject(timestamp =[$1 ], category=[$0 ], max(value )=[$2])
9+ LogicalAggregate(group=[{0, 1}], max(value )=[MAX ($2)])
10+ LogicalProject(category =[$1 ], timestamp=[SPAN($3, 1, 'w') ], value =[$2 ])
11+ LogicalFilter(condition=[AND(IS NOT NULL($3 ), IS NOT NULL($2 ))])
12+ CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data ]])
13+ LogicalProject(category =[$0], __grand_total__=[$1], _row_number_chart_=[ROW_NUMBER() OVER (ORDER BY $1 DESC NULLS LAST)])
1414 LogicalAggregate(group=[{0}], __grand_total__=[SUM($1)])
1515 LogicalFilter(condition=[IS NOT NULL($0)])
16- LogicalProject(age=[SAFE_CAST($1) ], avg(balance )=[$2])
17- LogicalAggregate(group=[{0, 1}], avg(balance )=[AVG ($2)])
18- LogicalProject(gender =[$4 ], age=[$10 ], balance =[$7 ])
19- LogicalFilter(condition=[AND(IS NOT NULL($4 ), IS NOT NULL($7 ))])
20- CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank ]])
16+ LogicalProject(category=[$0 ], max(value )=[$2])
17+ LogicalAggregate(group=[{0, 1}], max(value )=[MAX ($2)])
18+ LogicalProject(category =[$1 ], $f1=[SPAN($3, 1, 'w') ], value =[$2 ])
19+ LogicalFilter(condition=[AND(IS NOT NULL($3 ), IS NOT NULL($2 ))])
20+ CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data ]])
2121 physical : |
2222 EnumerableLimit(fetch=[10000])
2323 EnumerableSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])
24- EnumerableCalc(expr#0..3=[{inputs}], expr#4=[0], expr#5=[=($t3, $t4)], expr#6=[null:DOUBLE], expr#7=[CASE($t5, $t6, $t2)], expr#8=[/($t7, $t3)], proj#0..1=[{exprs}], avg(balance)=[$t8])
25- EnumerableAggregate(group=[{0, 1}], agg#0=[$SUM0($2)], agg#1=[COUNT($2)])
26- EnumerableCalc(expr#0..4=[{inputs}], expr#5=[IS NULL($t1)], expr#6=['NULL':VARCHAR], expr#7=[10:BIGINT], expr#8=[<=($t4, $t7)], expr#9=['OTHER':VARCHAR], expr#10=[CASE($t5, $t6, $t8, $t1, $t9)], gender=[$t0], age=[$t10], avg(balance)=[$t2])
27- EnumerableMergeJoin(condition=[=($1, $3)], joinType=[left])
28- EnumerableSort(sort0=[$1], dir0=[ASC])
29- EnumerableCalc(expr#0..2=[{inputs}], expr#3=[SAFE_CAST($t1)], gender=[$t0], age=[$t3], avg(balance)=[$t2])
30- CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[gender, balance, age], FILTER->AND(IS NOT NULL($0), IS NOT NULL($1)), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},avg(balance)=AVG($2))], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"must":[{"exists":{"field":"gender","boost":1.0}},{"exists":{"field":"balance","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["gender","balance","age"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"gender":{"terms":{"field":"gender.keyword","missing_bucket":true,"missing_order":"first","order":"asc"}}},{"age":{"terms":{"field":"age","missing_bucket":true,"missing_order":"first","order":"asc"}}}]},"aggregations":{"avg(balance)":{"avg":{"field":"balance"}}}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
31- EnumerableSort(sort0=[$0], dir0=[ASC])
32- EnumerableCalc(expr#0..2=[{inputs}], age=[$t0], $1=[$t2])
33- EnumerableWindow(window#0=[window(order by [1 DESC-nulls-last] rows between UNBOUNDED PRECEDING and CURRENT ROW aggs [ROW_NUMBER()])])
34- EnumerableAggregate(group=[{0}], __grand_total__=[SUM($1)])
35- EnumerableCalc(expr#0..1=[{inputs}], expr#2=[SAFE_CAST($t0)], expr#3=[IS NOT NULL($t2)], age=[$t2], avg(balance)=[$t1], $condition=[$t3])
36- CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[gender, balance, age], FILTER->AND(IS NOT NULL($0), IS NOT NULL($1)), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},avg(balance)=AVG($2)), PROJECT->[age, avg(balance)]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"must":[{"exists":{"field":"gender","boost":1.0}},{"exists":{"field":"balance","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["gender","balance","age"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"gender":{"terms":{"field":"gender.keyword","missing_bucket":true,"missing_order":"first","order":"asc"}}},{"age":{"terms":{"field":"age","missing_bucket":true,"missing_order":"first","order":"asc"}}}]},"aggregations":{"avg(balance)":{"avg":{"field":"balance"}}}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
24+ EnumerableAggregate(group=[{0, 1}], max(value)=[MAX($2)])
25+ EnumerableCalc(expr#0..4=[{inputs}], expr#5=[IS NULL($t1)], expr#6=['NULL':VARCHAR], expr#7=[10:BIGINT], expr#8=[<=($t4, $t7)], expr#9=['OTHER':VARCHAR], expr#10=[CASE($t5, $t6, $t8, $t1, $t9)], timestamp=[$t0], category=[$t10], max(value)=[$t2])
26+ EnumerableMergeJoin(condition=[=($1, $3)], joinType=[left])
27+ CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data]], PushDownContext=[[PROJECT->[category, value, timestamp], FILTER->AND(IS NOT NULL($2), IS NOT NULL($1)), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},max(value)=MAX($2)), PROJECT->[timestamp, category, max(value)], SORT->[1]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"must":[{"exists":{"field":"timestamp","boost":1.0}},{"exists":{"field":"value","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["category","value","timestamp"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"category":{"terms":{"field":"category","missing_bucket":true,"missing_order":"last","order":"asc"}}},{"timestamp":{"date_histogram":{"field":"timestamp","missing_bucket":false,"order":"asc","calendar_interval":"1w"}}}]},"aggregations":{"max(value)":{"max":{"field":"value"}}}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
28+ EnumerableSort(sort0=[$0], dir0=[ASC])
29+ EnumerableCalc(expr#0..2=[{inputs}], category=[$t0], $1=[$t2])
30+ EnumerableWindow(window#0=[window(order by [1 DESC-nulls-last] rows between UNBOUNDED PRECEDING and CURRENT ROW aggs [ROW_NUMBER()])])
31+ EnumerableAggregate(group=[{0}], __grand_total__=[SUM($1)])
32+ CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_time_data]], PushDownContext=[[PROJECT->[category, value, timestamp], FILTER->AND(IS NOT NULL($2), IS NOT NULL($1)), FILTER->IS NOT NULL($0), AGGREGATION->rel#:LogicalAggregate.NONE.[](input=RelSubset#,group={0, 1},max(value)=MAX($2)), PROJECT->[category, max(value)]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":0,"timeout":"1m","query":{"bool":{"filter":[{"bool":{"must":[{"exists":{"field":"timestamp","boost":1.0}},{"exists":{"field":"value","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},{"exists":{"field":"category","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["category","value","timestamp"],"excludes":[]},"aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"category":{"terms":{"field":"category","missing_bucket":true,"missing_order":"first","order":"asc"}}},{"timestamp":{"date_histogram":{"field":"timestamp","missing_bucket":false,"order":"asc","calendar_interval":"1w"}}}]},"aggregations":{"max(value)":{"max":{"field":"value"}}}}}}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
0 commit comments