According to CnosDB's insert syntax, I am trying to write duplicate data points (same timestamp + same tag but different field values in different batch), these data points should have been merged together into one data point. I am using v2.0.1.
See my lab below:
- Create a table with two tags:
CREATE TABLE test (
a BIGINT,
b BIGINT,
c BIGINT,
TAGS(id,name)
);
- Insert a data point with field "a" ONLY
INSERT INTO test (TIME, id,a) VALUES('2023-03-28 16:00:00', '1',100);
SELECT * FROM test;
Result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 100 |
- Insert a data point with field "b" ONLY
INSERT INTO test (TIME, id,b) VALUES('2023-03-28 16:00:00', '1',200);
SELECT * FROM test;
Result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 100 | 200 |
- Insert a data point with field "a"(same), "b"(same), "c"(new)
INSERT INTO test (TIME, id,a,b,c) VALUES('2023-03-28 16:00:00', '1',100,200,300);
SELECT * FROM test;
Result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 100 | 200 | 300 |
- Insert a data point with field "a"(different) ONLY
INSERT INTO test (TIME, id,a) VALUES('2023-03-28 16:00:00', '1',110);
SELECT * FROM test;
Result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 100 | 200 | 300 | |
2023-03-28T16:00:00.000000000 | 1 | 110 |
Expected result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 110 | 200 | 300 |
- Insert a data point with field "a"(different), "b"(different), "c"(different)
INSERT INTO test (TIME, id,a,b,c) VALUES('2023-03-28 16:00:00', '1',120,220,320);
SELECT * FROM test;
Result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 100 | 200 | 300 | |
2023-03-28T16:00:00.000000000 | 1 | 110 | 220 | 320 | |
2023-03-28T16:00:00.000000000 | 1 | 120 |
Expected result:
time | id | name | a | b | c |
---|---|---|---|---|---|
2023-03-28T16:00:00.000000000 | 1 | 120 | 220 | 320 |
Any workaround here?