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

load data bug #22735

Closed
zoujia-cm opened this issue Feb 5, 2021 · 7 comments
Closed

load data bug #22735

zoujia-cm opened this issue Feb 5, 2021 · 7 comments
Assignees

Comments

@zoujia-cm
Copy link
Contributor

zoujia-cm commented Feb 5, 2021

Bug Report

create a table:
create table ct(ch varchar(255), ch2 varchcar(255));

I have a csv file under /root directory, it's content like:
'ss','ee'|'rr','ss'

When I execute:
load data local infile '/root/test.csv' into table ct fields terminated by ',' enclosed by '\'' lines terminated by '|' (ch,ch2);
'ss' is stored as 'ss'\n.

when I execute :
select * from ct;
the output like:
+-------+-------+
| ch | ch2 |
+-------+-------+
| ss | ee |
+-------+-------+
| rr | 'ss'
|
+-------+-------+

1. Minimal reproduce step (Required)

create database test;
use test;
create table ct(ch varchar(255), ch2 varchar(255));
load data local infile '/root/test.csv' into table ct fields terminated by ',' enclosed by ''' lines terminated by '|' (ch,ch2);

2. What did you expect to see? (Required)

+----+----+
| ch | ch2|
+----+----+
| ss | ee |
+----+---+
| rr | ss |
+- --+-- -+

3. What did you see instead (Required)

+-------+-------+
| ch | ch2 |
+-------+-------+
| ss | ee |
+-------+-------+
| rr | 'ss'
|
+-------+-------+

4. What is your TiDB version? (Required)

master
5.0.0-rc
4.0.10
4.0.9

5.7.25-TiDB-v4.0.0-beta.2-2101-g17a65ab-dirty
v5.0.0-rc

@zoujia-cm zoujia-cm added the type/bug The issue is confirmed as a bug. label Feb 5, 2021
@XuHuaiyu XuHuaiyu added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Feb 5, 2021
@tohghua
Copy link

tohghua commented Feb 15, 2021

The case is: the csv file ends with '\n'. You can confirm this by check the file size: 20B
Mysql behaves the same in this case.
If you remove the trailing '\n', you won't get the single quote, still the same as mysql.

@bb7133
Copy link
Member

bb7133 commented Feb 18, 2021

Hi @zoujia-cm ,& @tohghua Since the behavior is the same as MySQL, I don't think it should be fixed. Do you agree with me?

@AilinKid
Copy link
Contributor

Hi @zoujia-cm ,& @tohghua Since the behavior is the same as MySQL, I don't think it should be fixed. Do you agree with me?

+1

@tohghua
Copy link

tohghua commented Feb 19, 2021

Hi @zoujia-cm ,& @tohghua Since the behavior is the same as MySQL, I don't think it should be fixed. Do you agree with me?

+2

@zoujia-cm
Copy link
Contributor Author

Hi @zoujia-cm ,& @tohghua Since the behavior is the same as MySQL, I don't think it should be fixed. Do you agree with me?

fundamentally agree with you

@bb7133
Copy link
Member

bb7133 commented Feb 20, 2021

Sure @zoujia-cm , I will close this issue for now.

Thanks for pointing out it! BTW you can join our Slack channel for the discussions of related bugfixes/improvements of TiDB.

@bb7133 bb7133 closed this as completed Feb 20, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@seiya-annie seiya-annie removed the type/bug The issue is confirmed as a bug. label Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants