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

[Improve][Connector-v2] Use regex to match filedName placeholders in jdbc sink #8222

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

dailai
Copy link
Contributor

@dailai dailai commented Dec 5, 2024

Purpose of this pull request

When the filed name of sink table containes '-' that can lead to this error
截屏2024-12-05 16 47 57

This is because the method named Character.isJavaIdentifierPart which is in FieldNamedPreparedStatement that return false when the param is '-'. So that the filedName will be split into two filedName.

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@Hisoka-X
Copy link
Member

Hisoka-X commented Dec 5, 2024

Is there a way to support all special characters? e.g. "$","%","@" etc.

@dailai dailai force-pushed the hotfix-jdbc-sink branch 2 times, most recently from a2101a3 to f8dfe78 Compare December 6, 2024 00:25
@dailai
Copy link
Contributor Author

dailai commented Dec 6, 2024

Is there a way to support all special characters? e.g. "$","%","@" etc.

I use a regular expression to match as many characters as we can, but because the framework uses :filedName as a placeholder and computes index from filedName in that placeholder, there's still a problem if filedName also appears : character.

After this pr, we can support filedName placeholder like this:

:USER@TOKEN
:字段%名称
:field_name
:field.name
:field-name
:$fieldName
:field&key
:field*value
:field#1
:field~test
:field!data
:field?question
:field^caret
:field+add
:field=value
:fieldmax
:field|pipe

@dailai dailai changed the title [Improve][Connector-v2] Support '-' in filedName placeholders in jdbc sink [Improve][Connector-v2] Use regex to match filedName placeholders in jdbc sink Dec 6, 2024
@dailai
Copy link
Contributor Author

dailai commented Dec 6, 2024

Link pr #7297

@dailai dailai requested review from hailin0 and Hisoka-X December 9, 2024 02:02
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

LGTM if ci passes.

@dailai
Copy link
Contributor Author

dailai commented Dec 11, 2024

Let me merge it. The ci is no problem. The failed ci link pr #8262 .

@dailai dailai merged commit c02d4fe into apache:dev Dec 11, 2024
4 of 5 checks passed
@dailai dailai deleted the hotfix-jdbc-sink branch December 11, 2024 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants