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

[Improvement][SQL Task]use default sql segment separator #10869

Merged
merged 3 commits into from
Sep 26, 2022

Conversation

zhuxt2015
Copy link
Contributor

@zhuxt2015 zhuxt2015 commented Jul 9, 2022

Purpose of the pull request

fix #10870

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:

@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2022

Codecov Report

Merging #10869 (cacd82f) into dev (ada7cf7) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##                dev   #10869      +/-   ##
============================================
- Coverage     39.05%   39.04%   -0.01%     
+ Complexity     4079     4078       -1     
============================================
  Files          1010     1010              
  Lines         37716    37714       -2     
  Branches       4329     4329              
============================================
- Hits          14731    14727       -4     
- Misses        21298    21299       +1     
- Partials       1687     1688       +1     
Impacted Files Coverage Δ
.../org/apache/dolphinscheduler/spi/enums/DbType.java 0.00% <0.00%> (ø)
...uler/plugin/task/api/parameters/SqlParameters.java 63.00% <ø> (+1.83%) ⬆️
...erver/master/processor/queue/TaskEventService.java 75.00% <0.00%> (-5.36%) ⬇️
...e/dolphinscheduler/remote/NettyRemotingClient.java 52.14% <0.00%> (-0.72%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zhongjiajie
Copy link
Member

I think we should better add ;\n as the default value, and users can overwrite it in our web ui. it makes our SQL task more general and does not break the previous behavior. WDYT @zhuangchong it seems you are the function creaetor

@zhuxt2015
Copy link
Contributor Author

I think we should better add ;\n as the default value, and users can overwrite it in our web ui. it makes our SQL task more general and does not break the previous behavior. WDYT @zhuangchong it seems you are the function creaetor

Can anyone tell me where did the original demand come from? I think it is useless. please remember Less is more.

@zhuangchong
Copy link
Contributor

@zhuxt2015
The original requirement is that the SQL task supports multi-stage SQL execution, for example, the requirement to execute multiple MySQL insert statements in one SQL task.

I have a different opinion from you, and I do not recommend you to modify it in this way. From your PR, you provide a default delimiter in the code. This is no problem when using the MySQL data source, but when using the Hive data source, this delimiter is not needed, Hive itself supports executing multiple segmented statements at a time.

The description of the document I provided is not clear. What I have implemented is

  1. The data source that does not support the execution of multiple segmented statements at a time, and I want to execute multiple SQL tasks of multiple segmented statements at a time, at this time, I need to fill in this separator on the page, For example, MySQL, PG
  2. Supports data sources that execute multiple segmented statements at a time, without input separators, like Hive

I agree with what you said Less is more, I also think that this delimiter should not be filled in by the user, this parameter is related to the data source, I have expressed my thoughts in PR #9917, if you have time consider implementing

@zhuxt2015
Copy link
Contributor Author

@zhuangchong
Thanks for the reply.
I made a special judgment about the hive data source, not split hive sql. A more elegant implementation is to add an isSupportMultipleStatement function to the DataSourceClient class. WDYT?
image

@zhuangchong
Copy link
Contributor

@zhuxt2015
Good idea, I'm not sure that all datasource's statement separator is semicolon, suggestion is optional, and provide default value for this function

@zhuxt2015
Copy link
Contributor Author

zhuxt2015 commented Jul 11, 2022

@zhuangchong
I'm sure that all datasource's statement separator is semicolon, it is a part of the ANSI SQL-92 standard. Furthermore, I add isSupportMultipleStatement in DbType instead of DataSourceClient

@zhuxt2015
Copy link
Contributor Author

@zhuangchong @zhongjiajie PTAL

zhuangchong
zhuangchong previously approved these changes Aug 3, 2022
Copy link
Contributor

@zhuangchong zhuangchong left a comment

Choose a reason for hiding this comment

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

+1

@zhongjiajie
Copy link
Member

@zhuxt2015 it is a incometible change, please also add some description in https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/guide/upgrede/incompatible.md and the ref Chinese doc, thanks

@zhuxt2015
Copy link
Contributor Author

@zhuxt2015 it is a incometible change, please also add some description in https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/guide/upgrede/incompatible.md and the ref Chinese doc, thanks

ok

@zhongjiajie
Copy link
Member

@zhuxt2015 sorry for reply late, and please solve the conflict, thanks

@zhuxt2015 zhuxt2015 force-pushed the split_sql_by_separator branch from 51e3dea to a7a63f2 Compare August 28, 2022 10:29
EricGao888
EricGao888 previously approved these changes Sep 8, 2022
Copy link
Member

@EricGao888 EricGao888 left a comment

Choose a reason for hiding this comment

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

LGTM except few nits. PTAL when available, thanks : ) @zhuangchong @zhongjiajie @rickchengx

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 9, 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 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

EricGao888
EricGao888 previously approved these changes Sep 10, 2022
@EricGao888 EricGao888 added the improvement make more easy to user or prompt friendly label Sep 10, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@EricGao888 EricGao888 left a comment

Choose a reason for hiding this comment

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

Backend part LGTM. It would be better if we could have a corresponding UT case.

@EricGao888
Copy link
Member

If there are no more comments, I will proceed to merge this PR tomorrow.

Copy link
Contributor

@davidzollo davidzollo left a comment

Choose a reason for hiding this comment

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

+1
LGTM, Adding UT case will be better

Backend part LGTM. It would be better if we could have a corresponding UT case.

Copy link
Contributor

@zhuangchong zhuangchong left a comment

Choose a reason for hiding this comment

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

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend document improvement make more easy to user or prompt friendly incompatible UI ui and front end related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement][Task] Use default sql segment separator for the SQL task
7 participants