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

bug: load data return error #1609

Closed
2 of 3 tasks
davidshiz opened this issue Apr 20, 2023 · 5 comments · Fixed by #1843
Closed
2 of 3 tasks

bug: load data return error #1609

davidshiz opened this issue Apr 20, 2023 · 5 comments · Fixed by #1843
Assignees
Labels
A-feature feature with good idea good first issue Good for newcomers

Comments

@davidshiz
Copy link
Collaborator

davidshiz commented Apr 20, 2023

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

mysql> CREATE TABLE t1 (c1 CHAR(36) NOT NULL,
                       c2 CHAR(36) DEFAULT NULL,
                      c3 VARCHAR(100) DEFAULT NULL,
                     c4 VARCHAR(100) DEFAULT NULL)
                      ;
Query OK, 0 rows affected (0.03 sec)

mysql> LOAD DATA INFILE '/stonedb57/install/mysql-test/std_data/bug28039829.dat' INTO TABLE t1;
ERROR 1406 (22001): Data too long for column 'c1' at row 1

Expected behavior

mysql> CREATE TABLE t1 (c1 CHAR(36) NOT NULL,
    -> c2 CHAR(36) DEFAULT NULL,
    -> c3 VARCHAR(100) DEFAULT NULL,
    -> c4 VARCHAR(100) DEFAULT NULL);
Query OK, 0 rows affected (0.02 sec)

mysql> LOAD DATA INFILE '/stonedb57/install/mysql-test/std_data/bug28039829.dat' INTO TABLE t1;
Query OK, 77701 rows affected (1.02 sec)
Records: 77701  Deleted: 0  Skipped: 0  Warnings: 0

How To Reproduce

No response

Environment

root@ub01:/stonedb57/install/bin# ./mysqld --version
./mysqld  Ver 5.7.36-StoneDB-v1.0.3 for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 99c5e80fb
        Last commit time: Date:   Wed Apr 12 00:34:41 2023 +0800
        Build time: Date: Tue Apr 18 00:43:18 CST 2023

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Apr 20, 2023
@davidshiz davidshiz added this to the StoneDB_5.7_v1.0.4 milestone Apr 20, 2023
@RingsC RingsC self-assigned this May 4, 2023
@RingsC RingsC added the prio: high High priority label May 31, 2023
@RingsC
Copy link
Contributor

RingsC commented May 31, 2023

Pls, use this statement to load data. @davidshiz

mysql> load data infile '/home/xxx/workshop/bin_ver1/mysql-test/std_data/bug28039829.dat' INTO TABLE t1 FIELDS TERMINATED BY '\t';
Query OK, 77701 rows affected (1 min 23.32 sec)
Records: 77701  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from t1 limit 1; 
+--------------------------------------+------+------+-------+
| c1                                   | c2   | c3   | c4    |
+--------------------------------------+------+------+-------+
| 000582dc-89a9-4fba-82ad-7fc25d6dc5b6 | 1    | NULL | Other |
+--------------------------------------+------+------+-------+
1 row in set (0.03 sec)

@davidshiz
Copy link
Collaborator Author

tianmu does not support the default fileds delimiter '\t', convert to feature

@davidshiz davidshiz added A-feature feature with good idea and removed A-bug Something isn't working prio: high High priority labels May 31, 2023
@RingsC
Copy link
Contributor

RingsC commented May 31, 2023

tianmu does not support the default fileds delimiter '\t', convert to feature

Tianmu default delimiter is ';' not '\t'.

  delimiter_ = ";",
  string_qualifier_ = 0 '\000',
  escape_character_ = 0 '\000',
  opt_enclosed_ = 0,
  line_starter_ = "",
  line_terminator_ = "\n",
  charsets_dir_ = "/home/lihao/workshop/bin_ver1/share/charsets/",
  charset_info_number_ = 45,
  skip_lines_ = 0,
  table_id_ = -1886417009,
  value_list_elements_ = 0,
  local_load_ = 0,
  lock_option_ = -1,
  thd_ = 0x7fdae0003060,
  sign_ = 1,
  minute_ = -32768,
  base_path_ = "/home/xxx/workshop/bin_ver1/data/",
  table_name_ = "test/t1",
  null_str_ = "",
  reject_file_ = "",
  abort_on_count_ = 0,
  abort_on_threshold_ = 0,
  install_path_ = "",
  loginfo_ptr_ = 0x7fdded5a15e0,
  table_ = 0x7fdae000f8e0

@davidshiz
Copy link
Collaborator Author

davidshiz commented May 31, 2023

ref https://dev.mysql.com/doc/refman/5.7/en/load-data.html

If you specify no FIELDS or LINES clause, the defaults are the same as if you had written this:

FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\'
LINES TERMINATED BY '\n' STARTING BY ''

@davidshiz davidshiz added A-bug Something isn't working good first issue Good for newcomers A-feature feature with good idea and removed A-feature feature with good idea A-bug Something isn't working labels May 31, 2023
@RingsC
Copy link
Contributor

RingsC commented May 31, 2023

fixed.

mysql> load data infile '/home/xxx/workshop/bin_ver1/mysql-test/std_data/bug28039829.dat' INTO TABLE t1;
No connection. Trying to reconnect...
Connection id:    2
Current database: test

Query OK, 77701 rows affected (1 min 22.06 sec)
Records: 77701  Deleted: 0  Skipped: 0  Warnings: 0

mysql> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-feature feature with good idea good first issue Good for newcomers
Projects
Development

Successfully merging a pull request may close this issue.

2 participants