mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
feat: return new added columns in region server's extension response (#3533)
* feat: adapt the new proto response Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update interfaces Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * write columns to extension Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * use physical column's schema Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * sort logical columns by name Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * format code Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * return physical table's column Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Update src/common/meta/src/datanode_manager.rs Co-authored-by: JeremyHi <jiachun_feng@proton.me> * implement sort column logic Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * proxy create table procedure to create logical table Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add unit test for sort_columns Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update sqlness cases Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: JeremyHi <jiachun_feng@proton.me>
This commit is contained in:
@@ -38,9 +38,9 @@ DESC TABLE t1;
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
| Column | Type | Key | Null | Default | Semantic Type |
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
| host | String | PRI | YES | | TAG |
|
||||
| ts | TimestampMillisecond | PRI | NO | | TIMESTAMP |
|
||||
| val | Float64 | | YES | | FIELD |
|
||||
| host | String | PRI | YES | | TAG |
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
|
||||
DESC TABLE t2;
|
||||
@@ -48,8 +48,8 @@ DESC TABLE t2;
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
| Column | Type | Key | Null | Default | Semantic Type |
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
| ts | TimestampMillisecond | PRI | NO | | TIMESTAMP |
|
||||
| job | String | PRI | YES | | TAG |
|
||||
| ts | TimestampMillisecond | PRI | NO | | TIMESTAMP |
|
||||
| val | Float64 | | YES | | FIELD |
|
||||
+--------+----------------------+-----+------+---------+---------------+
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@ CREATE TABLE t1 (ts timestamp time index, val double, host string primary key) e
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO t1 VALUES (0, 0, 'host1'), (1, 1, 'host2');
|
||||
INSERT INTO t1 VALUES ('host1',0, 0), ('host2', 1, 1,);
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
SELECT * from t1;
|
||||
|
||||
+-------------------------+-----+-------+
|
||||
| ts | val | host |
|
||||
+-------------------------+-----+-------+
|
||||
| 1970-01-01T00:00:00.001 | 1.0 | host2 |
|
||||
| 1970-01-01T00:00:00 | 0.0 | host1 |
|
||||
+-------------------------+-----+-------+
|
||||
+-------+-------------------------+-----+
|
||||
| host | ts | val |
|
||||
+-------+-------------------------+-----+
|
||||
| host2 | 1970-01-01T00:00:00.001 | 1.0 |
|
||||
| host1 | 1970-01-01T00:00:00 | 0.0 |
|
||||
+-------+-------------------------+-----+
|
||||
|
||||
CREATE TABLE t2 (ts timestamp time index, job string primary key, val double) engine = metric with ("on_physical_table" = "phy");
|
||||
|
||||
@@ -28,18 +28,18 @@ SELECT * from t2;
|
||||
++
|
||||
++
|
||||
|
||||
INSERT INTO t2 VALUES (0, 'job1', 0), (1, 'job2', 1);
|
||||
INSERT INTO t2 VALUES ('job1', 0, 0), ('job2', 1, 1);
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
SELECT * from t2;
|
||||
|
||||
+-------------------------+------+-----+
|
||||
| ts | job | val |
|
||||
+-------------------------+------+-----+
|
||||
| 1970-01-01T00:00:00.001 | job2 | 1.0 |
|
||||
| 1970-01-01T00:00:00 | job1 | 0.0 |
|
||||
+-------------------------+------+-----+
|
||||
+------+-------------------------+-----+
|
||||
| job | ts | val |
|
||||
+------+-------------------------+-----+
|
||||
| job2 | 1970-01-01T00:00:00.001 | 1.0 |
|
||||
| job1 | 1970-01-01T00:00:00 | 0.0 |
|
||||
+------+-------------------------+-----+
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ CREATE TABLE phy (ts timestamp time index, val double) engine=metric with ("phys
|
||||
|
||||
CREATE TABLE t1 (ts timestamp time index, val double, host string primary key) engine = metric with ("on_physical_table" = "phy");
|
||||
|
||||
INSERT INTO t1 VALUES (0, 0, 'host1'), (1, 1, 'host2');
|
||||
INSERT INTO t1 VALUES ('host1',0, 0), ('host2', 1, 1,);
|
||||
|
||||
SELECT * from t1;
|
||||
|
||||
@@ -10,7 +10,7 @@ CREATE TABLE t2 (ts timestamp time index, job string primary key, val double) en
|
||||
|
||||
SELECT * from t2;
|
||||
|
||||
INSERT INTO t2 VALUES (0, 'job1', 0), (1, 'job2', 1);
|
||||
INSERT INTO t2 VALUES ('job1', 0, 0), ('job2', 1, 1);
|
||||
|
||||
SELECT * from t2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user