Tidb: Feature Request: LOAD DATA LOCAL INFILE does not support IGNORE LINES

Created on 23 Aug 2018  路  3Comments  路  Source: pingcap/tidb

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    I tried to import a csv file, using instructions in the MySQL manual:
mysql> LOAD DATA LOCAL INFILE '2017Q1-capitalbikeshare-tripdata.csv' INTO TABLE trips
    ->   FIELDS TERMINATED BY ',' ENCLOSED BY '"'
    ->   LINES TERMINATED BY '\r\n'
    -> IGNORE 1 LINES;
ERROR 1105 (HY000): line 4 column 7 near " 1 LINES" (total length 165)

Big data sets are often distributed as CSV, and in this case it had a header row which needs to be skipped.

  1. What did you expect to see?
    MySQL behavior:
mysql [localhost] {msandbox} (bikeshare) > LOAD DATA LOCAL INFILE '2017Q1-capitalbikeshare-tripdata.csv' INTO TABLE trips
    ->   FIELDS TERMINATED BY ',' ENCLOSED BY '"'
    ->   LINES TERMINATED BY '\r\n'
    -> IGNORE 1 LINES;

Query OK, 646510 rows affected (4.56 sec)
Records: 646510  Deleted: 0  Skipped: 0  Warnings: 0
  1. What did you see instead?

An error (the IGNORE 1 LINES syntax is not supported).

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v2.1.0-beta-278-g1fa5669fb
Git Commit Hash: 1fa5669fb48ae0c6cf2d99413d62c7652f872c4e
Git Branch: master
UTC Build Time: 2018-08-23 07:38:51
GoVersion: go version go1.10.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.01 sec)
statuTODO typenhancement

Most helpful comment

I am going to do it, if no one is doing it?

All 3 comments

I am going to do it, if no one is doing it?

@mccxj Great! You could assign this issue to yourself.

Fixed in #7576

Was this page helpful?
0 / 5 - 0 ratings