Files
greptimedb/tests/cases/standalone/common/promql/encode_substrait.result

58 lines
6.5 KiB
Plaintext

create table count_total (
ts timestamp time index,
tag_a string,
tag_b string,
val double,
primary key (tag_a, tag_b),
);
Affected Rows: 0
-- if `RangeManipulate` can be encoded/decoded correctly in substrait, the following queries should pass
-- SQLNESS REPLACE (peers.*) REDACTED
-- SQLNESS REPLACE (partitioning.*) REDACTED
tql explain (0, 100, '1s')
max_over_time(increase(count_total{
tag_a="ffa",
}[1h])[12h:1h]);
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | MergeScan [is_placeholder=false, remote_input=[ |
| | Filter: prom_max_over_time(ts_range,prom_increase(ts_range,val,ts,Int64(3600000))) IS NOT NULL |
| | Projection: count_total.ts, prom_max_over_time(ts_range, prom_increase(ts_range,val,ts,Int64(3600000))) AS prom_max_over_time(ts_range,prom_increase(ts_range,val,ts,Int64(3600000))), count_total.tag_a, count_total.tag_b |
| | PromRangeManipulate: req range=[0..100000], interval=[1000], eval range=[43200000], time index=[ts], values=["prom_increase(ts_range,val,ts,Int64(3600000))"] |
| | PromSeriesDivide: tags=["tag_a", "tag_b"] |
| | Sort: count_total.tag_a ASC NULLS FIRST, count_total.tag_b ASC NULLS FIRST, count_total.ts ASC NULLS FIRST |
| | Projection: count_total.ts, prom_increase(ts_range,val,ts,Int64(3600000)), count_total.tag_a, count_total.tag_b |
| | Filter: prom_increase(ts_range,val,ts,Int64(3600000)) IS NOT NULL |
| | Projection: count_total.ts, prom_increase(ts_range, val, count_total.ts, Int64(3600000)) AS prom_increase(ts_range,val,ts,Int64(3600000)), count_total.tag_a, count_total.tag_b, __promql_metric_name |
| | Projection: count_total.ts, count_total.tag_a, count_total.tag_b, val, ts_range, Utf8("count_total") FieldMetadata { inner: {"greptime:promql:role": "metric_name"} } AS __promql_metric_name |
| | PromRangeManipulate: req range=[-39600000..100000], interval=[3600000], eval range=[3600000], time index=[ts], values=["val"] |
| | PromSeriesNormalize: offset=[0], time index=[ts], filter NaN: [true] |
| | PromSeriesDivide: tags=["tag_a", "tag_b"] |
| | Sort: count_total.tag_a ASC NULLS FIRST, count_total.tag_b ASC NULLS FIRST, count_total.ts ASC NULLS FIRST |
| | Filter: count_total.tag_a = Utf8("ffa") AND count_total.ts >= TimestampMillisecond(-43199999, None) AND count_total.ts <= TimestampMillisecond(100000, None) |
| | TableScan: count_total, partial_filters=[count_total.tag_a = Utf8("ffa"), count_total.ts >= TimestampMillisecond(-43199999, None), count_total.ts <= TimestampMillisecond(100000, None)] |
| | ]] |
| physical_plan | CooperativeExec |
| | MergeScanExec: REDACTED
| | |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
tql eval (0, 100, '1s')
max_over_time(increase(count_total{
tag_a="ffa",
}[1h])[12h:1h]);
+----+----------------------------------------------------------------------------+-------+-------+
| ts | prom_max_over_time(ts_range,prom_increase(ts_range,val,ts,Int64(3600000))) | tag_a | tag_b |
+----+----------------------------------------------------------------------------+-------+-------+
+----+----------------------------------------------------------------------------+-------+-------+
drop table count_total;
Affected Rows: 0