Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tianmu): fix bug: The data type was not determined during load data. (#852) #1105

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mysql-test/suite/tianmu/r/issue1000.result
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ create temporary table error_log (row int auto_increment primary key, suspicio
load data infile 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue1000.txt' into table error_log fields terminated by 'xykls37' escaped by '' ignore 1 lines (line) set file_name='/home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err';
select * from error_log;
row suspicious file_name line
1 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.545786Z 0 [Warning] The synta
2 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.545885Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --e
1 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.545786Z 0 [Warning] The syntax '--master-retry-count' is deprecated and will be removed in a future release. Please use 'CHANGE MASTER TO master_retry_count = <num>' instead.
2 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.545885Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
3 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.546902Z 0 [Warning] Insecure configuration for --secure-file-priv: Data directory is accessible through --secure-file-priv. Consider choosing a different directory.
4 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.546916Z 0 [Warning] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
5 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.856735Z 0 [Warning] unknown variable 'loose-mysql
6 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.856749Z 0 [Warning] unknown variable 'loose-mysql
7 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.858729Z 0 [Warning] No e
5 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.856735Z 0 [Warning] unknown variable 'loose-mysqlx-port=13020'
6 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.856749Z 0 [Warning] unknown variable 'loose-mysqlx-socket=/home/Code/GitHub/stonedb/build/install/mysql-test/var/tmp/mysqlx.2.sock'
7 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.858729Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: e90ca738-6b76-11ed-b11c-000c2921dc32.
8 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.861317Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
9 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.861325Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
10 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.861798Z 0 [Warning] CA certificate /home/Code/GitHub/stonedb/build/install/mysql-test/std_data/cacert.pem is self signed.
11 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.861860Z 0 [Warning] RSA private key file not found: /home/Code/GitHub/stonedb/build/install/mysql-test/var/mysqld.2/data//private_key.pem. Some authentication plugins will not work.
12 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:37.861871Z 0 [Warning] RSA public key file not found: /home/Code/GitHub/stonedb/build/install/mysql-test/var/mysqld.2/data//public_key.pem. Some authentication plugins will not work.
13 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:38.116846Z 5 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Synta
13 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:38.116846Z 5 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
14 1 /home/Code/GitHub/stonedb/build/install/mysql-test/var/log/mysqld.2.err 2022-11-23T21:36:38.117197Z 6 [Warning] Slave SQL for channel '': If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0
#
# Clean Resource
Expand Down
47 changes: 47 additions & 0 deletions mysql-test/suite/tianmu/r/issue852.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
USE test;
CREATE TABLE IF NOT EXISTS `lineorder_flat` (
`LO_ORDERDATE` date NOT NULL COMMENT '',
`LO_ORDERKEY` int(11) NOT NULL COMMENT '',
`LO_LINENUMBER` tinyint(4) NOT NULL COMMENT '',
`LO_CUSTKEY` int(11) NOT NULL COMMENT '',
`LO_PARTKEY` int(11) NOT NULL COMMENT '',
`LO_SUPPKEY` int(11) NOT NULL COMMENT '',
`LO_ORDERPRIORITY` varchar(100) NOT NULL COMMENT '',
`LO_SHIPPRIORITY` tinyint(4) NOT NULL COMMENT '',
`LO_QUANTITY` tinyint(4) NOT NULL COMMENT '',
`LO_EXTENDEDPRICE` int(11) NOT NULL COMMENT '',
`LO_ORDTOTALPRICE` int(11) NOT NULL COMMENT '',
`LO_DISCOUNT` tinyint(4) NOT NULL COMMENT '',
`LO_REVENUE` int(11) NOT NULL COMMENT '',
`LO_SUPPLYCOST` int(11) NOT NULL COMMENT '',
`LO_TAX` tinyint(4) NOT NULL COMMENT '',
`LO_COMMITDATE` date NOT NULL COMMENT '',
`LO_SHIPMODE` varchar(100) NOT NULL COMMENT '',
`C_NAME` varchar(100) NOT NULL COMMENT '',
`C_ADDRESS` varchar(100) NOT NULL COMMENT '',
`C_CITY` varchar(100) NOT NULL COMMENT '',
`C_NATION` varchar(100) NOT NULL COMMENT '',
`C_REGION` varchar(100) NOT NULL COMMENT '',
`C_PHONE` varchar(100) NOT NULL COMMENT '',
`C_MKTSEGMENT` varchar(100) NOT NULL COMMENT '',
`S_NAME` varchar(100) NOT NULL COMMENT '',
`S_ADDRESS` varchar(100) NOT NULL COMMENT '',
`S_CITY` varchar(100) NOT NULL COMMENT '',
`S_NATION` varchar(100) NOT NULL COMMENT '',
`S_REGION` varchar(100) NOT NULL COMMENT '',
`S_PHONE` varchar(100) NOT NULL COMMENT '',
`P_NAME` varchar(100) NOT NULL COMMENT '',
`P_MFGR` varchar(100) NOT NULL COMMENT '',
`P_CATEGORY` varchar(100) NOT NULL COMMENT '',
`P_BRAND` varchar(100) NOT NULL COMMENT '',
`P_COLOR` varchar(100) NOT NULL COMMENT '',
`P_TYPE` varchar(100) NOT NULL COMMENT '',
`P_SIZE` tinyint(4) NOT NULL COMMENT '',
`P_CONTAINER` varchar(100) NOT NULL COMMENT ''
) engine = tianmu ;
LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue852.txt' Into TABLE lineorder_flat FIELDS TERMINATED BY ',' enclosed by '"' ;
select * from lineorder_flat;
LO_ORDERDATE LO_ORDERKEY LO_LINENUMBER LO_CUSTKEY LO_PARTKEY LO_SUPPKEY LO_ORDERPRIORITY LO_SHIPPRIORITY LO_QUANTITY LO_EXTENDEDPRICE LO_ORDTOTALPRICE LO_DISCOUNT LO_REVENUE LO_SUPPLYCOST LO_TAX LO_COMMITDATE LO_SHIPMODE C_NAME C_ADDRESS C_CITY C_NATION C_REGION C_PHONE C_MKTSEGMENT S_NAME S_ADDRESS S_CITY S_NATION S_REGION S_PHONE P_NAME P_MFGR P_CATEGORY P_BRAND P_COLOR P_TYPE P_SIZE P_CONTAINER
1998-07-21 34 1 12202 88362 727 3-MEDIUM 0 13 1755468 5894967 0 1755468 81021 7 1998-09-14 REG AIR Customer#000012202 crWpqvyx4fOpC3IP JAPAN 5 JAPAN ASIA 22-437-209-5615 FURNITURE Supplier#000000727 HO,lDAVvCDTthJs3oYHW BRAZIL 4 BRAZIL AMERICA 12-815-316-3525 dim thistle MFGR#2 MFGR#23 MFGR#236 seashell ECONOMY POLISHED STEEL 39 WRAP BAG
1998-07-21 34 1 12202 88362 727 3-MEDIUM 0 13 1755468 5894967 0 1755468 81021 7 1998-09-14 REG AIR Customer#000012203 crWpqvyx4fOpC3IP JAPAN 5 JAPAN ASIA 22-437-209-5615 FURNITURE Supplier#000000727 HO,XDAVvCDTthJs3oYHW BRAZIL 4 BRAZIL AMERICA 12-815-316-3525 dim thistle MFGR#2 MFGR#23 MFGR#236 seashell ECONOMY POLISHED STEEL 49 WRAP BAG
drop table lineorder_flat;
2 changes: 2 additions & 0 deletions mysql-test/suite/tianmu/std_data/issue852.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
19980721,34,1,12202,88362,727,3-MEDIUM,0,13,1755468,5894967,0,1755468,81021,7,19980914,REG AIR,Customer#000012202,crWpqvyx4fOpC3IP,JAPAN 5,JAPAN,ASIA,22-437-209-5615,FURNITURE,Supplier#000000727,"HO,lDAVvCDTthJs3oYHW",BRAZIL 4,BRAZIL,AMERICA,12-815-316-3525,dim thistle,MFGR#2,MFGR#23,MFGR#236,seashell,ECONOMY POLISHED STEEL,39,WRAP BAG
19980721,34,1,12202,88362,727,3-MEDIUM,0,13,1755468,5894967,0,1755468,81021,7,19980914,REG AIR,Customer#000012203,crWpqvyx4fOpC3IP,JAPAN 5,JAPAN,ASIA,22-437-209-5615,FURNITURE,Supplier#000000727,"HO,XDAVvCDTthJs3oYHW",BRAZIL 4,BRAZIL,AMERICA,12-815-316-3525,dim thistle,MFGR#2,MFGR#23,MFGR#236,seashell,ECONOMY POLISHED STEEL,49,WRAP BAG
49 changes: 49 additions & 0 deletions mysql-test/suite/tianmu/t/issue852.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
--source include/have_tianmu.inc

USE test;

CREATE TABLE IF NOT EXISTS `lineorder_flat` (
`LO_ORDERDATE` date NOT NULL COMMENT '',
`LO_ORDERKEY` int(11) NOT NULL COMMENT '',
`LO_LINENUMBER` tinyint(4) NOT NULL COMMENT '',
`LO_CUSTKEY` int(11) NOT NULL COMMENT '',
`LO_PARTKEY` int(11) NOT NULL COMMENT '',
`LO_SUPPKEY` int(11) NOT NULL COMMENT '',
`LO_ORDERPRIORITY` varchar(100) NOT NULL COMMENT '',
`LO_SHIPPRIORITY` tinyint(4) NOT NULL COMMENT '',
`LO_QUANTITY` tinyint(4) NOT NULL COMMENT '',
`LO_EXTENDEDPRICE` int(11) NOT NULL COMMENT '',
`LO_ORDTOTALPRICE` int(11) NOT NULL COMMENT '',
`LO_DISCOUNT` tinyint(4) NOT NULL COMMENT '',
`LO_REVENUE` int(11) NOT NULL COMMENT '',
`LO_SUPPLYCOST` int(11) NOT NULL COMMENT '',
`LO_TAX` tinyint(4) NOT NULL COMMENT '',
`LO_COMMITDATE` date NOT NULL COMMENT '',
`LO_SHIPMODE` varchar(100) NOT NULL COMMENT '',
`C_NAME` varchar(100) NOT NULL COMMENT '',
`C_ADDRESS` varchar(100) NOT NULL COMMENT '',
`C_CITY` varchar(100) NOT NULL COMMENT '',
`C_NATION` varchar(100) NOT NULL COMMENT '',
`C_REGION` varchar(100) NOT NULL COMMENT '',
`C_PHONE` varchar(100) NOT NULL COMMENT '',
`C_MKTSEGMENT` varchar(100) NOT NULL COMMENT '',
`S_NAME` varchar(100) NOT NULL COMMENT '',
`S_ADDRESS` varchar(100) NOT NULL COMMENT '',
`S_CITY` varchar(100) NOT NULL COMMENT '',
`S_NATION` varchar(100) NOT NULL COMMENT '',
`S_REGION` varchar(100) NOT NULL COMMENT '',
`S_PHONE` varchar(100) NOT NULL COMMENT '',
`P_NAME` varchar(100) NOT NULL COMMENT '',
`P_MFGR` varchar(100) NOT NULL COMMENT '',
`P_CATEGORY` varchar(100) NOT NULL COMMENT '',
`P_BRAND` varchar(100) NOT NULL COMMENT '',
`P_COLOR` varchar(100) NOT NULL COMMENT '',
`P_TYPE` varchar(100) NOT NULL COMMENT '',
`P_SIZE` tinyint(4) NOT NULL COMMENT '',
`P_CONTAINER` varchar(100) NOT NULL COMMENT ''
) engine = tianmu ;

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
RingsC marked this conversation as resolved.
Show resolved Hide resolved
eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/tianmu/std_data/issue852.txt' Into TABLE lineorder_flat FIELDS TERMINATED BY ',' enclosed by '"' ;
select * from lineorder_flat;
drop table lineorder_flat;
2 changes: 0 additions & 2 deletions storage/tianmu/loader/parsing_strategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ void ParsingStrategy::GetValue(const char *value_ptr, size_t value_size, ushort
for (size_t j = 0; j < value_size; j++) {
if (value_ptr[j] == escape_char_)
buf[new_size] = TranslateEscapedChar(value_ptr[++j]);
else if (value_ptr[j] == *delimiter_.c_str())
break;
else
buf[new_size] = value_ptr[j];
new_size++;
Expand Down