Skip to content

Commit 60a72d5

Browse files
committed
add integration tests
1 parent a718bca commit 60a72d5

File tree

4 files changed

+220
-2
lines changed

4 files changed

+220
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
DROP TABLE IF EXISTS `issue341_t1`;
2+
3+
affected_rows: 0
4+
5+
DROP TABLE IF EXISTS `issue341_t2`;
6+
7+
affected_rows: 0
8+
9+
CREATE TABLE `issue341_t1` (
10+
`timestamp` timestamp NOT NULL,
11+
`value` int,
12+
`tag1` string tag,
13+
timestamp KEY (timestamp)) ENGINE=Analytic
14+
WITH(
15+
enable_ttl='false',
16+
update_mode='append'
17+
);
18+
19+
affected_rows: 0
20+
21+
INSERT INTO `issue341_t1` (`timestamp`, `value`, `tag1`)
22+
VALUES (1, 1, "t1"), (2, 2, "t2"), (3, 3, "t3");
23+
24+
affected_rows: 3
25+
26+
SELECT
27+
`timestamp`,
28+
`value`
29+
FROM
30+
`issue341_t1`;
31+
32+
timestamp,value,
33+
Timestamp(1),Int32(1),
34+
Timestamp(3),Int32(3),
35+
Timestamp(2),Int32(2),
36+
37+
38+
SELECT
39+
`timestamp`,
40+
`value`
41+
FROM
42+
`issue341_t1`
43+
WHERE
44+
`value` = 3;
45+
46+
timestamp,value,
47+
Timestamp(3),Int32(3),
48+
49+
50+
EXPLAIN SELECT
51+
`timestamp`,
52+
`value`
53+
FROM
54+
`issue341_t1`
55+
WHERE
56+
`value` = 3;
57+
58+
plan_type,plan,
59+
String("logical_plan"),String("Projection: issue341_t1.timestamp, issue341_t1.value\n TableScan: issue341_t1 projection=[timestamp, value], full_filters=[issue341_t1.value = Int32(3)]"),
60+
String("physical_plan"),String("ProjectionExec: expr=[timestamp@0 as timestamp, value@1 as value]\n ScanTable: table=issue341_t1, parallelism=8\n"),
61+
62+
63+
EXPLAIN SELECT
64+
`timestamp`,
65+
`value`
66+
FROM
67+
`issue341_t1`
68+
WHERE
69+
tag1 = "t3";
70+
71+
plan_type,plan,
72+
String("logical_plan"),String("Projection: issue341_t1.timestamp, issue341_t1.value\n TableScan: issue341_t1 projection=[timestamp, value, tag1], full_filters=[issue341_t1.tag1 = Utf8(\"t3\")]"),
73+
String("physical_plan"),String("ProjectionExec: expr=[timestamp@0 as timestamp, value@1 as value]\n ScanTable: table=issue341_t1, parallelism=8\n"),
74+
75+
76+
CREATE TABLE `issue341_t2` (
77+
`timestamp` timestamp NOT NULL,
78+
`value` double,
79+
`tag1` string tag,
80+
timestamp KEY (timestamp)) ENGINE=Analytic
81+
WITH(
82+
enable_ttl='false',
83+
update_mode='overwrite'
84+
);
85+
86+
affected_rows: 0
87+
88+
INSERT INTO `issue341_t2` (`timestamp`, `value`, `tag1`)
89+
VALUES (1, 1, "t1"), (2, 2, "t2"), (3, 3, "t3");
90+
91+
affected_rows: 3
92+
93+
SELECT
94+
`timestamp`,
95+
`value`
96+
FROM
97+
`issue341_t2`
98+
WHERE
99+
`value` = 3;
100+
101+
timestamp,value,
102+
Timestamp(3),Double(3.0),
103+
104+
105+
EXPLAIN SELECT
106+
`timestamp`,
107+
`value`
108+
FROM
109+
`issue341_t2`
110+
WHERE
111+
`value` = 3;
112+
113+
plan_type,plan,
114+
String("logical_plan"),String("Projection: issue341_t2.timestamp, issue341_t2.value\n Filter: issue341_t2.value = Float64(3)\n TableScan: issue341_t2 projection=[timestamp, value], partial_filters=[issue341_t2.value = Float64(3)]"),
115+
String("physical_plan"),String("ProjectionExec: expr=[timestamp@0 as timestamp, value@1 as value]\n CoalesceBatchesExec: target_batch_size=8192\n FilterExec: value@1 = 3\n ScanTable: table=issue341_t2, parallelism=8\n"),
116+
117+
118+
EXPLAIN SELECT
119+
`timestamp`,
120+
`value`
121+
FROM
122+
`issue341_t2`
123+
WHERE
124+
tag1 = "t3";
125+
126+
plan_type,plan,
127+
String("logical_plan"),String("Projection: issue341_t2.timestamp, issue341_t2.value\n TableScan: issue341_t2 projection=[timestamp, value, tag1], full_filters=[issue341_t2.tag1 = Utf8(\"t3\")]"),
128+
String("physical_plan"),String("ProjectionExec: expr=[timestamp@0 as timestamp, value@1 as value]\n ScanTable: table=issue341_t2, parallelism=8\n"),
129+
130+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
DROP TABLE IF EXISTS `issue341_t1`;
3+
DROP TABLE IF EXISTS `issue341_t2`;
4+
5+
CREATE TABLE `issue341_t1` (
6+
`timestamp` timestamp NOT NULL,
7+
`value` int,
8+
`tag1` string tag,
9+
timestamp KEY (timestamp)) ENGINE=Analytic
10+
WITH(
11+
enable_ttl='false',
12+
update_mode='append'
13+
);
14+
15+
INSERT INTO `issue341_t1` (`timestamp`, `value`, `tag1`)
16+
VALUES (1, 1, "t1"), (2, 2, "t2"), (3, 3, "t3");
17+
18+
SELECT
19+
`timestamp`,
20+
`value`
21+
FROM
22+
`issue341_t1`;
23+
24+
SELECT
25+
`timestamp`,
26+
`value`
27+
FROM
28+
`issue341_t1`
29+
WHERE
30+
`value` = 3;
31+
32+
-- FilterExec node should not be in plan.
33+
EXPLAIN SELECT
34+
`timestamp`,
35+
`value`
36+
FROM
37+
`issue341_t1`
38+
WHERE
39+
`value` = 3;
40+
41+
-- FilterExec node should not be in plan.
42+
EXPLAIN SELECT
43+
`timestamp`,
44+
`value`
45+
FROM
46+
`issue341_t1`
47+
WHERE
48+
tag1 = "t3";
49+
50+
-- Repeat operations above, but with overwrite table
51+
52+
CREATE TABLE `issue341_t2` (
53+
`timestamp` timestamp NOT NULL,
54+
`value` double,
55+
`tag1` string tag,
56+
timestamp KEY (timestamp)) ENGINE=Analytic
57+
WITH(
58+
enable_ttl='false',
59+
update_mode='overwrite'
60+
);
61+
62+
INSERT INTO `issue341_t2` (`timestamp`, `value`, `tag1`)
63+
VALUES (1, 1, "t1"), (2, 2, "t2"), (3, 3, "t3");
64+
65+
SELECT
66+
`timestamp`,
67+
`value`
68+
FROM
69+
`issue341_t2`
70+
WHERE
71+
`value` = 3;
72+
73+
-- FilterExec node should be in plan.
74+
EXPLAIN SELECT
75+
`timestamp`,
76+
`value`
77+
FROM
78+
`issue341_t2`
79+
WHERE
80+
`value` = 3;
81+
82+
-- When using tag as filter, FilterExec node should not be in plan.
83+
EXPLAIN SELECT
84+
`timestamp`,
85+
`value`
86+
FROM
87+
`issue341_t2`
88+
WHERE
89+
tag1 = "t3";

integration_tests/cases/env/local/influxql/basic.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SELECT "level_description", location, water_level FROM "h2o_feet" where location
4242
-- SQLNESS ARG protocol=influxql
4343
show measurements;
4444

45-
{"results":[{"statement_id":0,"series":[{"name":"measurements","columns":["name"],"values":[["h2o_feet"]]}]}]}
45+
{"results":[{"statement_id":0,"series":[{"name":"measurements","columns":["name"],"values":[["issue341_t1"],["issue341_t2"],["h2o_feet"]]}]}]}
4646

4747
-- SQLNESS ARG protocol=influxql
4848
SELECT count(water_level) FROM "h2o_feet"

table_engine/src/provider.rs

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ impl TableProviderAdapter {
219219

220220
fn pushdown_inner(&self, filters: &[&Expr]) -> Vec<TableProviderFilterPushDown> {
221221
let unique_keys = self.read_schema.unique_keys();
222-
223222
// TODO: add pushdown check in table trait
224223
let options = &self.table.options();
225224
let is_append = matches!(options.get(UPDATE_MODE), Some(mode) if mode == "APPEND");

0 commit comments

Comments
 (0)