mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 15:22:56 +00:00
fix: append table stats (#4561)
* fix: append table stats * fix: clippy
This commit is contained in:
@@ -168,6 +168,7 @@ impl ExecutionPlan for RegionScanExec {
|
||||
.iter()
|
||||
.map(|_| ColumnStatistics {
|
||||
distinct_count: Precision::Exact(self.total_rows),
|
||||
null_count: Precision::Exact(0), // all null rows are counted for append-only table
|
||||
..Default::default()
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
CREATE TABLE IF NOT EXISTS `test_table` (
|
||||
`bytes` BIGINT NULL,
|
||||
`http_version` STRING NULL,
|
||||
`ip` STRING NULL,
|
||||
`method` STRING NULL,
|
||||
`path` STRING NULL,
|
||||
`status` SMALLINT UNSIGNED NULL,
|
||||
`user` STRING NULL,
|
||||
`timestamp` TIMESTAMP(3) NOT NULL,
|
||||
TIME INDEX (`timestamp`),
|
||||
PRIMARY KEY (`user`, `path`, `status`)
|
||||
)
|
||||
ENGINE=mito
|
||||
WITH(
|
||||
append_mode = 'true'
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
EXPLAIN ANALYZE SELECT count(*) FROM test_table;
|
||||
|
||||
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| stage | node | plan |
|
||||
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| 0 | 0 | MergeScanExec: REDACTED
|
||||
| | | |
|
||||
| 1 | 0 | ProjectionExec: expr=[0 as COUNT(test_table.timestamp)] REDACTED
|
||||
| | | common_recordbatch::adapter::MetricCollector REDACTED
|
||||
| | | |
|
||||
| | | Total rows: 1 |
|
||||
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE IF NOT EXISTS `test_table` (
|
||||
`bytes` BIGINT NULL,
|
||||
`http_version` STRING NULL,
|
||||
`ip` STRING NULL,
|
||||
`method` STRING NULL,
|
||||
`path` STRING NULL,
|
||||
`status` SMALLINT UNSIGNED NULL,
|
||||
`user` STRING NULL,
|
||||
`timestamp` TIMESTAMP(3) NOT NULL,
|
||||
TIME INDEX (`timestamp`),
|
||||
PRIMARY KEY (`user`, `path`, `status`)
|
||||
)
|
||||
|
||||
ENGINE=mito
|
||||
WITH(
|
||||
append_mode = 'true'
|
||||
);
|
||||
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
EXPLAIN ANALYZE SELECT count(*) FROM test_table;
|
||||
Reference in New Issue
Block a user