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]: When using load data inline to import data, errors may occur if there are semicolons in the data #16790

Closed
1 task done
gaoy121 opened this issue Jun 11, 2024 · 9 comments
Assignees
Labels
kind/bug Something isn't working no-pr-linked Issue Closed without PR severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Milestone

Comments

@gaoy121
Copy link

gaoy121 commented Jun 11, 2024

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

v1.2.0

Commit ID

5522522

Other Environment Information

- Hardware parameters:
- OS type: Centos7
- Others:

Actual Behavior

执行如下load data 语句报错(数据部分 Shanxi;XiAn 带分号):

load data inline format='csv', data=$XXX$
zhangsan,26,Shanxi;XiAn $XXX$
into table user
fields terminated by ','
lines terminated by '\r\n'
(name,age,city)

报错信息如下:
image

Expected Behavior

No response

Steps to Reproduce

1.创建数据库
create database test;

2.创建数据表
use test;

CREATE TABLE `user` (
`name` VARCHAR(255) DEFAULT null,
`age` INT DEFAULT null,
`city` VARCHAR(255) DEFAULT null
)

3.执行load data语句
load data inline format='csv', data=$XXX$
zhangsan,26,Shanxi;XiAn $XXX$
into table user
fields terminated by ','
lines terminated by '\r\n'
(name,age,city)

Additional information

No response

@aronchanisme
Copy link
Contributor

Solution: consider pre-processing the data by adding enclosed character(like " by default, as illustrated here)
Currently stuck by this issue: #16794

@ouyuanning ouyuanning assigned huby2358 and jensenojs and unassigned matrix-meow and huby2358 Jun 12, 2024
@aronchanisme aronchanisme added this to the 1.2.2 milestone Jun 12, 2024
@aronchanisme aronchanisme added severity/s0 Extreme impact: Cause the application to break down and seriously affect the use mysql-compability labels Jun 27, 2024
@aressu1985 aressu1985 modified the milestones: 1.2.2, 1.3.0 Jul 7, 2024
@jensenojs
Copy link
Contributor

not working ont it

@jensenojs jensenojs assigned huby2358 and unassigned jensenojs Aug 17, 2024
@huby2358
Copy link
Contributor

image

@huby2358
Copy link
Contributor

企业微信截图_f783f079-4170-45d8-9a95-b7cc45f2c4ac

@huby2358
Copy link
Contributor

如上面截图所示,回退到issue的commit,按照issue中的步骤,是可以成功插入的,结果也是符合预期的,这种语法错误应该是必现的,怀疑是不是当时使用错误导致报错。

@aronchanisme
Copy link
Contributor

请用linux的环境复现(最新main和1.2-dev均能复现)
szpc
企业微信截图_b00c9add-1e37-4de9-af4f-83cb348010d3

129
企业微信截图_3fd816d8-2198-4400-af66-bb3058db9b8e

aron开发机
企业微信截图_66a44f88-0b0d-4ae8-960e-9f9d70e3235c

@huby2358
Copy link
Contributor

这个issue报错原因就是由于mysql客户端用分号作为切割,issue里面的load,会当成两条sql发到服务端,所以报语法错误。今天在8.0和8.3的mysql客户端都试了,8.3的客户端发到服务端的是一条sql,没有做切割(所以load成功,如我上面贴的load成功的图就是在8.3的客户端测试的。所以解决这个问题,建议升级到8.3看看

@huby2358
Copy link
Contributor

@gaoy121用8.3.0的客户端试了,满足要求,issue关了

@aronchanisme
Copy link
Contributor

closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working no-pr-linked Issue Closed without PR severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Projects
None yet
Development

No branches or pull requests

7 participants