close
Skip to content

[Fix][Connector-V2] Fix NullPointerException when column or tag contains null value in TDengine sink#9158

Merged
hailin0 merged 4 commits into
apache:devfrom
jia17:bugFix_TDengine_NULLPointer
Apr 16, 2025
Merged

[Fix][Connector-V2] Fix NullPointerException when column or tag contains null value in TDengine sink#9158
hailin0 merged 4 commits into
apache:devfrom
jia17:bugFix_TDengine_NULLPointer

Conversation

@jia17

@jia17 jia17 commented Apr 12, 2025

Copy link
Copy Markdown
Contributor

Purpose of this pull request

Fix #9104

Does this PR introduce any user-facing change?

no

How was this patch tested?

test in local

Check list

@Hisoka-X

Copy link
Copy Markdown
Member

Could you add a unit test for this?

@github-actions github-actions Bot added tdengine and removed CI&CD core SeaTunnel core module Zeta e2e api labels Apr 14, 2025
@jia17 jia17 force-pushed the bugFix_TDengine_NULLPointer branch from 27fe470 to 2cd1707 Compare April 14, 2025 15:01
@jia17

jia17 commented Apr 14, 2025

Copy link
Copy Markdown
Contributor Author

@Hisoka-X I have added a unit test for the function I changed. Could you please review this PR?

}

@Test
void testConvertDataType_withNull() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
void testConvertDataType_withNull() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
void testConvertDataTypeWithNull() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

Comment on lines +100 to +101
Method method = TDengineSinkWriter.class.getDeclaredMethod("convertDataType", Object[].class);
method.setAccessible(true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's better to not use reflect. Let's change convertDataType scope to default. Then add a annotation @VisibleForTesting.

@Hisoka-X

Copy link
Copy Markdown
Member

Also please follow the guide to open github action on your fork repository. Thanks! https://github.com/apache/seatunnel/pull/9158/checks?check_run_id=40516607099

@jia17

jia17 commented Apr 15, 2025

Copy link
Copy Markdown
Contributor Author

I have re-optimized the relevant functions based on your suggestions. Thank you!

@Hisoka-X

Copy link
Copy Markdown
Member

Please fix test case.
image

@jia17 jia17 force-pushed the bugFix_TDengine_NULLPointer branch from 58fd50f to 99e18b2 Compare April 15, 2025 09:21
@jia17 jia17 force-pushed the bugFix_TDengine_NULLPointer branch from e2f3ca9 to 99e18b2 Compare April 15, 2025 09:38
@github-actions github-actions Bot removed the document label Apr 15, 2025
@jia17 jia17 force-pushed the bugFix_TDengine_NULLPointer branch from 99e18b2 to 34f3890 Compare April 15, 2025 09:48
@jia17

jia17 commented Apr 15, 2025

Copy link
Copy Markdown
Contributor Author

I have fix the test case.

@Hisoka-X

Copy link
Copy Markdown
Member

Thanks @jia17

@hailin0 hailin0 merged commit a047cab into apache:dev Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [TDengineSinkWriter] get java.lang.NullPointerException if there are empty value in some column or tag in tdengine source tables

3 participants