Skip to content

Conversation

@zhuangchong
Copy link
Contributor

Purpose of the pull request

this pr close #9177

iShot2022-05-06_17 24 22

iShot2022-05-06_17 17 57

description:

The segment separator is used when the data source does not support multi-segment SQL execution, and the client needs to split the SQL and execute it multiple times.

such as:
1.Hive itself supports executing multiple sql statements at a time, you can write multiple statements directly in the sql script of sqlTask, the segmentSeparator does not need to write anything
2.mysql does not support executing multiple statements at a time, you can use this new function, write multiple statements in the sql script of SqlTask, add ; to the segmentSeparator

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 6, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

timeout: 30,
type: 'MYSQL',
displayRows: 10,
segmentSeparator: '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should set a default value of semicolon to reduce repeated operations of users. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, because this parameter refers to: this data source does not support the execution of multiple sql statements at a time. This parameter needs to be added, so that the program can split the sql segment and perform multiple queries;

for example, Hive supports one execution When there are multiple SQL statements, you do not need to add this parameter; Mysql does not support executing multiple statements at a time, you can use this new function, write multiple statements in the sql script of SqlTask, add ; to the segmentSeparator

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But i think it's too difficult for users to judge whether this parameter needs to be added. Is it better that we help users judge whether this parameter needs to be added instead of letting users to defined? @zhuangchong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SbloodyS
This suggestion is very good. I think whether this parameter needs to be related to the data source, provide default values ​​for different data sources, but this will change the data source module. I hope to optimize in the next PR, let SQLTask support this function first, and then provide different data sources to change the value of this parameter, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds goods to me. Thanks @zhuangchong

@zhuangchong
Copy link
Contributor Author

@SbloodyS Thanks.

@zhuangchong zhuangchong merged commit 0e7c98d into apache:dev May 8, 2022
@zhuangchong zhuangchong deleted the dev-imp-sql-task-multi-segment branch May 8, 2022 07:04
@zhongjiajie zhongjiajie added this to the 3.0.0-beta-1 milestone May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Task] The sql task supports configuring segmentation notation to provide execution of multiple statements

3 participants