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

[Fix-4191][Fix-4288] fix jar sqlstatement split #4292

Open
wants to merge 4 commits into
base: 1.2
Choose a base branch
from

Conversation

jiangwwwei
Copy link
Contributor

Purpose of the pull request

This PR resolves #4191
and #4288

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:

Comment on lines 336 to 340
中文:
如果EXECUTE JAR WITH前的语句没有正确的使用";"来结束,将无法匹配ExecuteJarParseStrategyUtil.match(),只能手动切分;
但是这个切分方法可能会把多个EXECUTE JAR WITH语句当作一个进行处理,因此优先使用前面的切分方法
*/
String regex = "(?is)(\\n *|^ *)EXECUTE\\s+JAR\\s+WITH\\s*\\(.+\\)\\s*;?\\s*";
Copy link
Contributor

Choose a reason for hiding this comment

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

Execute Jar is an extended implementation syntax. We shouldn't perform special handling here. Instead, it should be transformed into a common problem for fixing. For example, test whether other syntaxes encounter this problem in such a situation. If so, handle it uniformly here.
Execute Jar 是一个扩展实现语法,我们不应该在此处进行特殊处理,应该转化为共同问题修复。比如测试其他语法在遇到这个情况时是否会出现该问题,如果出现,则在此处统一处理。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 'EXECUTE JAR' statement is stored together with other statements, which may be affected by abnormal statements and thus fail to match correctly and completely. This is different from other extended syntaxes, where abnormalities only lead to execution failure. However, an incorrect 'EXECUTE JAR' directly causes the loss of task information returned by the interface.

Although we have implemented a logic to return all original data to initSqlStatement when 'EXECUTE JAR' is not matched, the original args of 'EXECUTE JAR' have already been converted into base64-encoded characters, which are difficult for users to handle. Therefore, it is still necessary to try to match and parse 'EXECUTE JAR' as much as possible. That's why I modified the matching rules of ExecuteJarParseStrategy this time.

If possible, storing 'EXECUTE JAR' separately in the future would likely be a better approach to handle these issues.


'EXECUTE JAR'与其他statement存储在一起,可能被异常的statement影响,从而无法正常完整匹配。
这与其他拓展语法是不同的,其他语法的异常只会导致执行失败,而不正确'EXECUTE JAR'会直接导致接口返回的任务信息丢失。

虽然已经增加了未匹配到'EXECUTE JAR'时返回所有原始数据到initSqlStatement的逻辑,
但是原始'EXECUTE JAR'的args已经变成了base64编码的字符,用户难以处理,
因此还是需要尽量匹配上'EXECUTE JAR'并解析,所以我这次修改了ExecuteJarParseStrategy的匹配规则

如果可以的话,将来单独存储EXECUTE JAR应该会更好处理这些问题

@jiangwwwei jiangwwwei force-pushed the 1.2-fix-jar-sqlstatement-split branch from 4e1e77c to b53ac57 Compare March 14, 2025 05:28
@jiangwwwei jiangwwwei force-pushed the 1.2-fix-jar-sqlstatement-split branch from b53ac57 to 6180242 Compare March 14, 2025 06:38
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.

2 participants