mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-04 12:22:55 +00:00
test: add basic cases for distributed TQL (#1437)
* test: add basic cases for distributed TQL Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * drop table Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -114,7 +114,8 @@ impl<'a> ParserContext<'a> {
|
||||
// TODO(dennis): supports multi TQL statements separated by ';'?
|
||||
}
|
||||
|
||||
Ok(query.trim().to_string())
|
||||
// remove the last ';' or tailing space if exists
|
||||
Ok(query.trim().trim_end_matches(';').to_string())
|
||||
} else {
|
||||
Err(ParserError::ParserError(format!("{delimiter} not found",)))
|
||||
}
|
||||
|
||||
32
tests/cases/standalone/common/tql/basic.result
Normal file
32
tests/cases/standalone/common/tql/basic.result
Normal file
@@ -0,0 +1,32 @@
|
||||
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING PRIMARY KEY);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO test VALUES (1, 1, "a"), (1, 1, "b"), (2, 2, "a");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
TQL EVAL (0, 10, '5s') test;
|
||||
|
||||
+-----+---------------------+---+
|
||||
| i | j | k |
|
||||
+-----+---------------------+---+
|
||||
| 2.0 | 1970-01-01T00:00:05 | a |
|
||||
| 2.0 | 1970-01-01T00:00:10 | a |
|
||||
| 1.0 | 1970-01-01T00:00:05 | b |
|
||||
| 1.0 | 1970-01-01T00:00:10 | b |
|
||||
+-----+---------------------+---+
|
||||
|
||||
TQL EVAL (0, 10, '5s') test{k="a"};
|
||||
|
||||
+-----+---------------------+---+
|
||||
| i | j | k |
|
||||
+-----+---------------------+---+
|
||||
| 2.0 | 1970-01-01T00:00:05 | a |
|
||||
| 2.0 | 1970-01-01T00:00:10 | a |
|
||||
+-----+---------------------+---+
|
||||
|
||||
DROP TABLE test;
|
||||
|
||||
Affected Rows: 1
|
||||
|
||||
12
tests/cases/standalone/common/tql/basic.sql
Normal file
12
tests/cases/standalone/common/tql/basic.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING PRIMARY KEY);
|
||||
|
||||
-- insert two points at 1ms and one point at 2ms
|
||||
INSERT INTO test VALUES (1, 1, "a"), (1, 1, "b"), (2, 2, "a");
|
||||
|
||||
-- evaluate at 0s, 5s and 10s. No point at 0s.
|
||||
TQL EVAL (0, 10, '5s') test;
|
||||
|
||||
-- the point at 1ms will be shadowed by the point at 2ms
|
||||
TQL EVAL (0, 10, '5s') test{k="a"};
|
||||
|
||||
DROP TABLE test;
|
||||
Reference in New Issue
Block a user