mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-14 17:23:09 +00:00
* basic impl Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix frontend logic Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add sqlness test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * check substrait compatibility before pushdown Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * going to revert some rules Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update sqlness result Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix test and clippy Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix compile error Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix typo Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove println Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Apply suggestions from code review Co-authored-by: Yingwen <realevenyag@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Yingwen <realevenyag@gmail.com>
73 lines
6.2 KiB
Plaintext
73 lines
6.2 KiB
Plaintext
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING PRIMARY KEY);
|
|
|
|
Affected Rows: 0
|
|
|
|
-- insert two points at 1ms and one point at 2ms
|
|
INSERT INTO test VALUES (1, 1, "a"), (1, 1, "b"), (2, 2, "a");
|
|
|
|
Affected Rows: 3
|
|
|
|
-- explain at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (peer-.*) REDACTED
|
|
TQL EXPLAIN (0, 10, '5s') test;
|
|
|
|
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| plan_type | plan |
|
|
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| logical_plan | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivide: tags=["k"] |
|
|
| | Sort: test.k DESC NULLS LAST, test.j DESC NULLS LAST |
|
|
| | MergeScan [is_placeholder=false] |
|
|
| | TableScan: test projection=[i, j, k], partial_filters=[j >= TimestampMillisecond(-300000, None), j <= TimestampMillisecond(300000, None)] |
|
|
| physical_plan | PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | RepartitionExec: partitioning=REDACTED
|
|
| | PromSeriesDivideExec: tags=["k"] |
|
|
| | MergeScanExec: peers=[REDACTED
|
|
| | |
|
|
+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
DROP TABLE test;
|
|
|
|
Affected Rows: 1
|
|
|
|
CREATE TABLE host_load1 (
|
|
ts TIMESTAMP(3) NOT NULL,
|
|
collector STRING NULL,
|
|
host STRING NULL,
|
|
val DOUBLE NULL,
|
|
TIME INDEX (ts),
|
|
PRIMARY KEY (collector, host)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (peer-.*) REDACTED
|
|
TQL EXPLAIN host_load1{__field__="val"};
|
|
|
|
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| plan_type | plan |
|
|
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| logical_plan | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[ts] |
|
|
| | PromSeriesNormalize: offset=[0], time index=[ts], filter NaN: [false] |
|
|
| | PromSeriesDivide: tags=["collector", "host"] |
|
|
| | Sort: host_load1.collector DESC NULLS LAST, host_load1.host DESC NULLS LAST, host_load1.ts DESC NULLS LAST |
|
|
| | MergeScan [is_placeholder=false] |
|
|
| | Projection: host_load1.val, host_load1.collector, host_load1.host, host_load1.ts |
|
|
| | TableScan: host_load1 projection=[ts, collector, host, val], partial_filters=[ts >= TimestampMillisecond(-300000, None), ts <= TimestampMillisecond(300000, None)] |
|
|
| physical_plan | PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[ts] |
|
|
| | PromSeriesNormalizeExec: offset=[0], time index=[ts], filter NaN: [false] |
|
|
| | RepartitionExec: partitioning=REDACTED
|
|
| | PromSeriesDivideExec: tags=["collector", "host"] |
|
|
| | MergeScanExec: peers=[REDACTED
|
|
| | |
|
|
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
DROP TABLE host_load1;
|
|
|
|
Affected Rows: 1
|
|
|