Skip to content

Commit bfc9f45

Browse files
committed
chore: revert the copy_from_fs_csv test
Signed-off-by: StandingMan <[email protected]>
1 parent f5d15f3 commit bfc9f45

File tree

2 files changed

+48
-108
lines changed

2 files changed

+48
-108
lines changed

tests/cases/standalone/common/copy/copy_from_fs_csv.result

Lines changed: 35 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,40 @@ values
1717

1818
Affected Rows: 1
1919

20-
CREATE TABLE demo_2(host string, ts TIMESTAMP time index);
21-
22-
Affected Rows: 0
23-
24-
insert into
25-
demo_2(host, ts)
26-
values
27-
('host4', 1755276557000),
28-
('host5', 1755276558000),
29-
('host6', 1822077263000);
30-
31-
Affected Rows: 3
32-
33-
Copy demo_2 TO '${SQLNESS_HOME}/demo/export/csv/demo_2.csv' with (format='csv');
34-
35-
Affected Rows: 3
36-
3720
Copy demo TO '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv');
3821

3922
Affected Rows: 3
4023

41-
CREATE TABLE check_header(host string, ts timestamp time index);
24+
CREATE TABLE with_filename(host string, cpu double, memory double, ts timestamp time index);
4225

4326
Affected Rows: 0
4427

45-
Copy check_header FROM '${SQLNESS_HOME}/demo/export/csv/' with (pattern = 'demo*', format='csv', header='true', continue_on_error='true');
28+
Copy with_filename FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:39');
4629

47-
Affected Rows: 3
30+
Affected Rows: 0
4831

49-
select * from check_header order by ts;
32+
select * from with_filename order by ts;
5033

51-
+-------+---------------------+
52-
| host | ts |
53-
+-------+---------------------+
54-
| host4 | 2025-08-15T16:49:17 |
55-
| host5 | 2025-08-15T16:49:18 |
56-
| host6 | 2027-09-27T20:34:23 |
57-
+-------+---------------------+
34+
++
35+
++
5836

59-
CREATE TABLE with_filename(host string, cpu double, memory double, ts timestamp time index);
37+
CREATE TABLE with_json(host string, cpu double, memory double, jsons JSON, ts timestamp time index);
6038

6139
Affected Rows: 0
6240

63-
Copy with_filename FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv', header='false', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:39');
41+
Copy with_json FROM '${SQLNESS_HOME}/demo/export/json/demo.json' with (format='json');
6442

65-
Affected Rows: 2
43+
Affected Rows: 3
6644

67-
select * from with_filename order by ts;
45+
select host, cpu, memory, json_to_string(jsons), ts from with_json order by ts;
6846

69-
+-------+------+--------+---------------------+
70-
| host | cpu | memory | ts |
71-
+-------+------+--------+---------------------+
72-
| host1 | 66.6 | 1024.0 | 2022-06-15T07:02:37 |
73-
| host2 | 88.8 | 333.3 | 2022-06-15T07:02:38 |
74-
+-------+------+--------+---------------------+
47+
+-------+------+--------+---------------------------------+---------------------+
48+
| host | cpu | memory | json_to_string(with_json.jsons) | ts |
49+
+-------+------+--------+---------------------------------+---------------------+
50+
| host1 | 66.6 | 1024.0 | {"foo":"bar"} | 2022-06-15T07:02:37 |
51+
| host2 | 88.8 | 333.3 | {"a":null,"foo":"bar"} | 2022-06-15T07:02:38 |
52+
| host3 | 99.9 | 444.4 | | 2024-07-27T10:47:43 |
53+
+-------+------+--------+---------------------------------+---------------------+
7554

7655
-- SQLNESS PROTOCOL MYSQL
7756
select host, cpu, memory, jsons, ts from demo where host != 'host3';
@@ -97,88 +76,63 @@ CREATE TABLE with_path(host string, cpu double, memory double, ts timestamp time
9776

9877
Affected Rows: 0
9978

100-
Copy with_path FROM '${SQLNESS_HOME}/demo/export/csv/' with (format='csv', header='false', start_time='2023-06-15 07:02:37');
79+
Copy with_path FROM '${SQLNESS_HOME}/demo/export/csv/' with (format='csv', start_time='2023-06-15 07:02:37');
10180

102-
Affected Rows: 4
81+
Affected Rows: 0
10382

10483
select * from with_path order by ts;
10584

106-
+-------+------+--------+---------------------+
107-
| host | cpu | memory | ts |
108-
+-------+------+--------+---------------------+
109-
| host3 | 99.9 | 444.4 | 2024-07-27T10:47:43 |
110-
| host4 | | | 2025-08-15T16:49:17 |
111-
| host5 | | | 2025-08-15T16:49:18 |
112-
| host6 | | | 2027-09-27T20:34:23 |
113-
+-------+------+--------+---------------------+
85+
++
86+
++
11487

11588
CREATE TABLE with_pattern(host string, cpu double, memory double, ts timestamp time index);
11689

11790
Affected Rows: 0
11891

119-
Copy with_pattern FROM '${SQLNESS_HOME}/demo/export/csv/' WITH (pattern = 'demo.*', format='csv', header='false', end_time='2025-06-15 07:02:39');
92+
Copy with_pattern FROM '${SQLNESS_HOME}/demo/export/csv/' WITH (pattern = 'demo.*', format='csv', end_time='2025-06-15 07:02:39');
12093

121-
Affected Rows: 3
94+
Affected Rows: 0
12295

12396
select * from with_pattern order by ts;
12497

125-
+-------+------+--------+---------------------+
126-
| host | cpu | memory | ts |
127-
+-------+------+--------+---------------------+
128-
| host1 | 66.6 | 1024.0 | 2022-06-15T07:02:37 |
129-
| host2 | 88.8 | 333.3 | 2022-06-15T07:02:38 |
130-
| host3 | 99.9 | 444.4 | 2024-07-27T10:47:43 |
131-
+-------+------+--------+---------------------+
98+
++
99+
++
132100

133101
CREATE TABLE demo_with_external_column(host string, cpu double, memory double, ts timestamp time index, external_column string default 'default_value');
134102

135103
Affected Rows: 0
136104

137-
Copy demo_with_external_column FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv', header='false');
105+
Copy demo_with_external_column FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv');
138106

139-
Affected Rows: 3
107+
Affected Rows: 0
140108

141109
select * from demo_with_external_column order by ts;
142110

143-
+-------+------+--------+---------------------+-----------------+
144-
| host | cpu | memory | ts | external_column |
145-
+-------+------+--------+---------------------+-----------------+
146-
| host1 | 66.6 | 1024.0 | 2022-06-15T07:02:37 | default_value |
147-
| host2 | 88.8 | 333.3 | 2022-06-15T07:02:38 | default_value |
148-
| host3 | 99.9 | 444.4 | 2024-07-27T10:47:43 | default_value |
149-
+-------+------+--------+---------------------+-----------------+
111+
++
112+
++
150113

151114
CREATE TABLE demo_with_less_columns(host string, memory double, ts timestamp time index);
152115

153116
Affected Rows: 0
154117

155-
Copy demo_with_less_columns FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv', header='false');
118+
Copy demo_with_less_columns FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv');
156119

157-
Affected Rows: 3
120+
Affected Rows: 0
158121

159122
select * from demo_with_less_columns order by ts;
160123

161-
+-------+--------+---------------------+
162-
| host | memory | ts |
163-
+-------+--------+---------------------+
164-
| host1 | 1024.0 | 2022-06-15T07:02:37 |
165-
| host2 | 333.3 | 2022-06-15T07:02:38 |
166-
| host3 | 444.4 | 2024-07-27T10:47:43 |
167-
+-------+--------+---------------------+
124+
++
125+
++
168126

169127
drop table demo;
170128

171129
Affected Rows: 0
172130

173-
drop table demo_2;
174-
175-
Affected Rows: 0
176-
177-
drop table check_header;
131+
drop table with_filename;
178132

179133
Affected Rows: 0
180134

181-
drop table with_filename;
135+
drop table with_json;
182136

183137
Affected Rows: 0
184138

tests/cases/standalone/common/copy/copy_from_fs_csv.sql

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,19 @@ insert into
1111
values
1212
('host3', 99.9, 444.4, 1722077263000);
1313

14-
15-
CREATE TABLE demo_2(host string, ts TIMESTAMP time index);
16-
17-
insert into
18-
demo_2(host, ts)
19-
values
20-
('host4', 1755276557000),
21-
('host5', 1755276558000),
22-
('host6', 1822077263000);
23-
24-
Copy demo_2 TO '${SQLNESS_HOME}/demo/export/csv/demo_2.csv' with (format='csv');
25-
2614
Copy demo TO '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv');
2715

28-
CREATE TABLE check_header(host string, ts timestamp time index);
16+
CREATE TABLE with_filename(host string, cpu double, memory double, ts timestamp time index);
2917

30-
Copy check_header FROM '${SQLNESS_HOME}/demo/export/csv/' with (pattern = 'demo*', format='csv', header='true', continue_on_error='true');
18+
Copy with_filename FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:39');
3119

32-
select * from check_header order by ts;
20+
select * from with_filename order by ts;
3321

34-
CREATE TABLE with_filename(host string, cpu double, memory double, ts timestamp time index);
22+
CREATE TABLE with_json(host string, cpu double, memory double, jsons JSON, ts timestamp time index);
3523

36-
Copy with_filename FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' with (format='csv', header='false', start_time='2022-06-15 07:02:37', end_time='2022-06-15 07:02:39');
24+
Copy with_json FROM '${SQLNESS_HOME}/demo/export/json/demo.json' with (format='json');
3725

38-
select * from with_filename order by ts;
26+
select host, cpu, memory, json_to_string(jsons), ts from with_json order by ts;
3927

4028
-- SQLNESS PROTOCOL MYSQL
4129
select host, cpu, memory, jsons, ts from demo where host != 'host3';
@@ -45,40 +33,38 @@ select host, cpu, memory, jsons, ts from demo where host != 'host3';
4533

4634
CREATE TABLE with_path(host string, cpu double, memory double, ts timestamp time index);
4735

48-
Copy with_path FROM '${SQLNESS_HOME}/demo/export/csv/' with (format='csv', header='false', start_time='2023-06-15 07:02:37');
36+
Copy with_path FROM '${SQLNESS_HOME}/demo/export/csv/' with (format='csv', start_time='2023-06-15 07:02:37');
4937

5038
select * from with_path order by ts;
5139

5240
CREATE TABLE with_pattern(host string, cpu double, memory double, ts timestamp time index);
5341

54-
Copy with_pattern FROM '${SQLNESS_HOME}/demo/export/csv/' WITH (pattern = 'demo.*', format='csv', header='false', end_time='2025-06-15 07:02:39');
42+
Copy with_pattern FROM '${SQLNESS_HOME}/demo/export/csv/' WITH (pattern = 'demo.*', format='csv', end_time='2025-06-15 07:02:39');
5543

5644
select * from with_pattern order by ts;
5745

5846
CREATE TABLE demo_with_external_column(host string, cpu double, memory double, ts timestamp time index, external_column string default 'default_value');
5947

60-
Copy demo_with_external_column FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv', header='false');
48+
Copy demo_with_external_column FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv');
6149

6250
select * from demo_with_external_column order by ts;
6351

6452
CREATE TABLE demo_with_less_columns(host string, memory double, ts timestamp time index);
6553

66-
Copy demo_with_less_columns FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv', header='false');
54+
Copy demo_with_less_columns FROM '${SQLNESS_HOME}/demo/export/csv/demo.csv' WITH (format='csv');
6755

6856
select * from demo_with_less_columns order by ts;
6957

7058
drop table demo;
7159

72-
drop table demo_2;
73-
74-
drop table check_header;
75-
7660
drop table with_filename;
7761

62+
drop table with_json;
63+
7864
drop table with_path;
7965

8066
drop table with_pattern;
8167

8268
drop table demo_with_external_column;
8369

84-
drop table demo_with_less_columns;
70+
drop table demo_with_less_columns;

0 commit comments

Comments
 (0)