Files
greptimedb/tests/cases/distributed/show/show_create.result
dennis zhuang 2a9f482bc7 feat: show create table (#1336)
* temp commit

* feat: impl Display for CreateTable statement

* feat: impl show create table for standalone

* fix: forgot show.rs

* feat: clean code

* fix: typo

* feat: impl show create table for distributed

* test: add show create table sqlness test

* fix: typo

* fix: sqlness tests

* feat: render partition rules for distributed table

* Update src/sql/src/statements.rs

Co-authored-by: Yingwen <realevenyag@gmail.com>

* Update src/sql/src/statements.rs

Co-authored-by: Yingwen <realevenyag@gmail.com>

* Update src/sql/src/statements.rs

Co-authored-by: Yingwen <realevenyag@gmail.com>

* Update src/sql/src/statements/create.rs

Co-authored-by: Yingwen <realevenyag@gmail.com>

* chore: by CR comments

* fix: compile error

* fix: missing column comments and extra table options

* test: add show create table test

* test: add show create table test

* chore: timestamp precision

* fix: test

---------

Co-authored-by: Yingwen <realevenyag@gmail.com>
2023-04-21 11:37:16 +08:00

48 lines
2.1 KiB
Plaintext

CREATE TABLE system_metrics (
id INT UNSIGNED,
host STRING,
cpu DOUBLE,
disk FLOAT,
n INT COMMENT 'range key',
ts TIMESTAMP NOT NULL DEFAULT current_timestamp(),
TIME INDEX (ts),
PRIMARY KEY (id, host)
)
PARTITION BY RANGE COLUMNS (n) (
PARTITION r0 VALUES LESS THAN (5),
PARTITION r1 VALUES LESS THAN (9),
PARTITION r2 VALUES LESS THAN (MAXVALUE),
)
ENGINE=mito;
Affected Rows: 0
SHOW CREATE TABLE system_metrics;
+----------------+---------------------------------------------------------+
| Table | Create Table |
+----------------+---------------------------------------------------------+
| system_metrics | CREATE TABLE IF NOT EXISTS system_metrics ( |
| | id INT UNSIGNED NULL, |
| | host STRING NULL, |
| | cpu DOUBLE NULL, |
| | disk FLOAT NULL, |
| | n INT NULL, |
| | ts TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
| | TIME INDEX (ts), |
| | PRIMARY KEY (id, host) |
| | ) |
| | PARTITION BY RANGE COLUMNS (n) ( |
| | PARTITION r0 VALUES LESS THAN (5), |
| | PARTITION r1 VALUES LESS THAN (9), |
| | PARTITION r2 VALUES LESS THAN (MAXVALUE) |
| | ) |
| | ENGINE=mito |
| | |
+----------------+---------------------------------------------------------+
DROP TABLE system_metrics;
Affected Rows: 1