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

[Feature][Transform-V2][SqlTransform] Support Not Like Expression #5456

Closed

Conversation

wu-a-ge
Copy link
Contributor

@wu-a-ge wu-a-ge commented Sep 10, 2023

Purpose of this pull request

Check list

@wu-a-ge
Copy link
Contributor Author

wu-a-ge commented Sep 10, 2023

close #5455

EricJoy2048
EricJoy2048 previously approved these changes Sep 12, 2023
@@ -47,7 +47,7 @@ transform {
Sql {
source_table_name = "fake"
result_table_name = "fake1"
query = "select id,name,age from fake where id=1 and id!=0 and name<>'Kin Dom' and (age>=20 or age<22) and regexp_like(name, '[A-Z ]*') and id>0 and id>=1 and id in (1,2,3,4) and id not in (5,6,7) and name is not null and email is null and id<4 and id<=4 and name like '%Din_'"
query = "select id,name,age from fake where id=1 and id!=0 and name<>'Kin Dom' and (age>=20 or age<22) and regexp_like(name, '[A-Z ]*') and id>0 and id>=1 and id in (1,2,3,4) and id not in (5,6,7) and name is not null and email is null and id<4 and id<=4 and name like '%Din_' and name not like 'Kin%'"
Copy link
Member

Choose a reason for hiding this comment

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

Seem like this test case doesn't affect test result after change query, so that we can't make sure that the result is what we want, could you add a test case for not like expression to make sure it will filter right row?

Copy link
Member

@EricJoy2048 EricJoy2048 Sep 14, 2023

Choose a reason for hiding this comment

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

You can use AssertSink to check the result.
A reference seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-2/src/test/resources/sql_transform/func_system.conf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK,I will add a test case

@wu-a-ge
Copy link
Contributor Author

wu-a-ge commented Sep 14, 2023

updated @Hisoka-X @EricJoy2048

Comment on lines 55 to 57
Container.ExecResult sqlNotLikeFilter =
container.executeJob("/sql_transform/not_like_filter.conf");
Assertions.assertEquals(0, sqlNotLikeFilter.getExitCode());
Copy link
Member

Choose a reason for hiding this comment

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

Please add a like IT

@@ -173,7 +173,7 @@ private boolean likeExpr(LikeExpression likeExpression, Object[] inputFields) {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(leftVal.toString());

return matcher.matches();
return matcher.matches() ^ likeExpression.isNot();
Copy link
Member

Choose a reason for hiding this comment

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

Can we split like with not like? this function is likeExpr but is is used in not like, this is strange .

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 it's necessary to add a not like expression, because that's where the SQL engine expresses the match and mismatch logic. I'm referring to the IN expression logic

@@ -0,0 +1,54 @@
env {
Copy link
Member

Choose a reason for hiding this comment

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

Please add license header

@ruanwenjun ruanwenjun added feature New feature and removed bug labels Sep 15, 2023
@ruanwenjun ruanwenjun changed the title [Hotfix][Transform-V2][SqlTransform] Support Not Like Expression [Feature][Transform-V2][SqlTransform] Support Not Like Expression Sep 15, 2023
@wu-a-ge
Copy link
Contributor Author

wu-a-ge commented Sep 15, 2023

updated @ruanwenjun

@EricJoy2048
Copy link
Member

updated @ruanwenjun

Please fix the ci error.

@EricJoy2048
Copy link
Member

I noticed a bug in CI that has already been fixed. You need to rebase the code from the dev branch and repush the code.

@wu-a-ge
Copy link
Contributor Author

wu-a-ge commented Sep 26, 2023

I noticed a bug in CI that has already been fixed. You need to rebase the code from the dev branch and repush the code.

OK

@EricJoy2048
Copy link
Member

Is there any latest progress on this PR? @wu-a-ge

@wu-a-ge
Copy link
Contributor Author

wu-a-ge commented Oct 21, 2023 via email

@hailin0
Copy link
Member

hailin0 commented Oct 25, 2023

Does anyone want to continue completing this PR?

@zhilinli123
Copy link
Contributor

Please assign this pr to me for the time being. I will take some time to learn and complete it in the near future. I think I will consult everyone if I have any doubts Thanks cc @hailin0 @EricJoy2048

@Carl-Zhou-CN
Copy link
Member

Completed by #5768 , close this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants