forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tianmu): support in-completed column data during load data. (sto…
…neatom#1209) [summary] 1. support few column; 2. support too many column; 3. support the data of column is not completed,such as 3.1 such as start with the enclosed char, finished without enclosed char; 3.2 without line-termination string, but reach to the end of file;
- Loading branch information
1 parent
6a21184
commit a1d0ad2
Showing
9 changed files
with
155 additions
and
44 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
DROP DATABASE IF EXISTS issue1209_test; | ||
CREATE DATABASE issue1209_test; | ||
USE issue1209_test; | ||
CREATE TABLE `t1_tianmu` ( | ||
`id` int(11) DEFAULT NULL, | ||
`a` char(20) DEFAULT NULL, | ||
`id2` int(11) DEFAULT NULL | ||
) ENGINE=tianmu DEFAULT CHARSET=utf8mb4; | ||
LOAD DATA LOCAL infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1209-1.txt' into table t1_tianmu FIELDS TERMINATED BY ',' LINES TERMINATED BY ';'; | ||
Warnings: | ||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns | ||
Warning 1261 Row 3 doesn't contain data for all columns | ||
Warning 1261 Row 4 doesn't contain data for all columns | ||
Warning 1261 Row 4 doesn't contain data for all columns | ||
Warning 1366 Incorrect integer value: ' | ||
' for column 'id' at row 5 | ||
Warning 1261 Row 5 doesn't contain data for all columns | ||
Warning 1261 Row 5 doesn't contain data for all columns | ||
select * from t1_tianmu; | ||
id a id2 | ||
1 chai 6 | ||
2 测试 3 | ||
3 chayicha NULL | ||
NULL NULL NULL | ||
0 NULL NULL | ||
truncate table t1_tianmu; | ||
LOAD DATA LOCAL infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1209-2.txt' into table t1_tianmu FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY ';'; | ||
Warnings: | ||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns | ||
Warning 1261 Row 3 doesn't contain data for all columns | ||
Warning 1261 Row 4 doesn't contain data for all columns | ||
Warning 1261 Row 4 doesn't contain data for all columns | ||
Warning 1261 Row 5 doesn't contain data for all columns | ||
Warning 1261 Row 5 doesn't contain data for all columns | ||
Warning 1261 Row 6 doesn't contain data for all columns | ||
select * from t1_tianmu; | ||
id a id2 | ||
1 chai 7 | ||
2 测试 8 | ||
3 chayicha NULL | ||
NULL NULL NULL | ||
5 NULL NULL | ||
4 "; | ||
NULL | ||
DROP DATABASE issue1209_test; |
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 @@ | ||
1,chai,6;2,测试,3,4;3,chayicha;; |
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 @@ | ||
1,"chai",7;2,"测试",8,9;3,"chayicha";;"5";"4","; |
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,27 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS issue1209_test; | ||
--enable_warnings | ||
|
||
CREATE DATABASE issue1209_test; | ||
|
||
USE issue1209_test; | ||
|
||
CREATE TABLE `t1_tianmu` ( | ||
`id` int(11) DEFAULT NULL, | ||
`a` char(20) DEFAULT NULL, | ||
`id2` int(11) DEFAULT NULL | ||
) ENGINE=tianmu DEFAULT CHARSET=utf8mb4; | ||
|
||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval LOAD DATA LOCAL infile '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue1209-1.txt' into table t1_tianmu FIELDS TERMINATED BY ',' LINES TERMINATED BY ';'; | ||
select * from t1_tianmu; | ||
|
||
truncate table t1_tianmu; | ||
|
||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval LOAD DATA LOCAL infile '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue1209-2.txt' into table t1_tianmu FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY ';'; | ||
select * from t1_tianmu; | ||
|
||
DROP DATABASE issue1209_test; |
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
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