-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable field pruning in last non null mode (#4740)
* fix: don't prune fields in last non null mode * test: add sqlness test for field pruning * test: add flush * refine implementation Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
- Loading branch information
Showing
3 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
CREATE TABLE IF NOT EXISTS prune_field ( | ||
ts TIMESTAMP TIME INDEX, | ||
tag UInt16, | ||
a UInt8, | ||
b UInt8, | ||
PRIMARY KEY (tag)) ENGINE = mito WITH('merge_mode'='last_non_null'); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into prune_field(ts, tag, a, b) values(0, 1, 1, null); | ||
|
||
Affected Rows: 1 | ||
|
||
admin flush_table('prune_field'); | ||
|
||
+----------------------------------+ | ||
| ADMIN flush_table('prune_field') | | ||
+----------------------------------+ | ||
| 0 | | ||
+----------------------------------+ | ||
|
||
insert into prune_field(ts, tag, a, b) values(0, 1, null, 1); | ||
|
||
Affected Rows: 1 | ||
|
||
admin flush_table('prune_field'); | ||
|
||
+----------------------------------+ | ||
| ADMIN flush_table('prune_field') | | ||
+----------------------------------+ | ||
| 0 | | ||
+----------------------------------+ | ||
|
||
select * from prune_field where a = 1; | ||
|
||
+---------------------+-----+---+---+ | ||
| ts | tag | a | b | | ||
+---------------------+-----+---+---+ | ||
| 1970-01-01T00:00:00 | 1 | 1 | 1 | | ||
+---------------------+-----+---+---+ | ||
|
||
select * from prune_field where b = 1; | ||
|
||
+---------------------+-----+---+---+ | ||
| ts | tag | a | b | | ||
+---------------------+-----+---+---+ | ||
| 1970-01-01T00:00:00 | 1 | 1 | 1 | | ||
+---------------------+-----+---+---+ | ||
|
||
select * from prune_field; | ||
|
||
+---------------------+-----+---+---+ | ||
| ts | tag | a | b | | ||
+---------------------+-----+---+---+ | ||
| 1970-01-01T00:00:00 | 1 | 1 | 1 | | ||
+---------------------+-----+---+---+ | ||
|
||
select * from prune_field where a = 1 and b = 1; | ||
|
||
+---------------------+-----+---+---+ | ||
| ts | tag | a | b | | ||
+---------------------+-----+---+---+ | ||
| 1970-01-01T00:00:00 | 1 | 1 | 1 | | ||
+---------------------+-----+---+---+ | ||
|
||
drop table prune_field; | ||
|
||
Affected Rows: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CREATE TABLE IF NOT EXISTS prune_field ( | ||
ts TIMESTAMP TIME INDEX, | ||
tag UInt16, | ||
a UInt8, | ||
b UInt8, | ||
PRIMARY KEY (tag)) ENGINE = mito WITH('merge_mode'='last_non_null'); | ||
|
||
insert into prune_field(ts, tag, a, b) values(0, 1, 1, null); | ||
|
||
admin flush_table('prune_field'); | ||
|
||
insert into prune_field(ts, tag, a, b) values(0, 1, null, 1); | ||
|
||
admin flush_table('prune_field'); | ||
|
||
select * from prune_field where a = 1; | ||
|
||
select * from prune_field where b = 1; | ||
|
||
select * from prune_field; | ||
|
||
select * from prune_field where a = 1 and b = 1; | ||
|
||
drop table prune_field; |