dble
dble copied to clipboard
load data returns error when separate line "\" in file
- dble version:Server version: 5.6.23-dble-2.19.05.2-14700a8a98c7f8d8081a78942b804bf65abdb5e5-20191030095612
-
preconditions :
1.create table test_shard:
CREATE TABLE `test_shard` (
`CLAIM_ID` decimal(19,0) NOT NULL,
`POLICY_ID` decimal(19,0) DEFAULT NULL,
`CHANNEL_CLAIM_NO` varchar(64) DEFAULT NULL,
`CHANNEL_POLICY_NO` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
2.create file test.txt
1|||2|||aa|||aa
2|||3|||bb|||aa
3|||30000|||cc\
\
|||aa
4|||5|||gg|||aa
- configs:
schema.xml
<schema name="testdb" sqlMaxLimit="10" dataNode="dn1">
<table name="test_shard" rule="rule_simple-id" dataNode="dn1,dn2,dn3,dn4"></table>
</schema>
rule.xml
<tableRule name="rule_simple-id">
<rule>
<columns>POLICY_ID</columns>
<algorithm>rule_simple</algorithm>
</rule>
<function name="rule_simple" class="Hash">
<property name="partitionCount">4</property>
<property name="partitionLength">1</property>
</function>
- steps:
- execute load data in dble 8066 port but return error,see belows:
mysql> load data infile "/opt/test.txt" into table test_shard fields terminated by '|||';
ERROR 1136 (HY000): row data can't not calculate a sharding value,Partition column is empty in line '\'
2.execute the same loaddata in mysql and query ok
mysql> load data local infile "/opt/test.txt" into table test_shard fields terminated by '|||';
Query OK, 4 rows affected (0.00 sec)
Records: 4 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from test_shard;
+----------+-----------+------------------+-------------------+
| CLAIM_ID | POLICY_ID | CHANNEL_CLAIM_NO | CHANNEL_POLICY_NO |
+----------+-----------+------------------+-------------------+
| 1 | 2 | aa | aa |
| 2 | 3 | bb | aa |
| 3 | 30000 | cc
| aa |
| 4 | 5 | gg | aa |
+----------+-----------+------------------+-------------------+
4 rows in set (0.00 sec)
-
expect result:
1.step 1 should execute success
https://github.com/actiontech/dble/issues/1456
verified on version: 5.6.29-dble-2.19.11.0-3924537e81390ba76656e3c5071c194c7be7923b-20200210030705 This issue is not the same promblem with https://github.com/actiontech/dble/issues/1456, this issue is separate line "" in field valus but not field separator .
In dble,we use univocity-parsers to read the file.
It will think that it is the termination of the line if read a \n
by default, even if the field is not finished.