-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
close #5455 |
@@ -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%'" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
updated @Hisoka-X @EricJoy2048 |
Container.ExecResult sqlNotLikeFilter = | ||
container.executeJob("/sql_transform/not_like_filter.conf"); | ||
Assertions.assertEquals(0, sqlNotLikeFilter.getExitCode()); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 .
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add license header
updated @ruanwenjun |
Please fix the ci error. |
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 |
Is there any latest progress on this PR? @wu-a-ge |
I’m sorry ,I’v no time
| |
傅大爷
|
|
***@***.***
|
---- Replied Message ----
| From | ***@***.***> |
| Date | 10/10/2023 17:35 |
| To | apache/seatunnel ***@***.***> |
| Cc | wu-a-ge ***@***.***>,
Mention ***@***.***> |
| Subject | Re: [apache/seatunnel] [Feature][Transform-V2][SqlTransform] Support Not Like Expression (PR #5456) |
Is there any latest progress on this PR? @wu-a-ge
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Does anyone want to continue completing this PR? |
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 |
Completed by #5768 , close this pr |
Purpose of this pull request
Check list
New License Guide
release-note
.