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][StarRocks] Fix NPE when upstream catalogtable table path only have table name part #6540

Merged
merged 4 commits into from Mar 29, 2024

Conversation

liunaijie
Copy link
Contributor

Purpose of this pull request

close #6524
in some source connector, it not set db name, so will get NPE here

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@liunaijie liunaijie changed the title [fix] fix NPE [fix][starrocks] fix NPE Mar 19, 2024
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.

Could you add a test case for this?

@liugddx liugddx added this to the 2.3.5 milestone Mar 22, 2024
@liunaijie
Copy link
Contributor Author

Could you add a test case for this?

@Hisoka-X in the current code, there has the NPE check https://github.com/apache/seatunnel/pull/6540/files#diff-ab5c2b43dd112473304501aa777993ab9cd746f3a12b6606f87523d92b5e9086R117. In this method i think the author is missing to check.

@Hisoka-X
Copy link
Member

Since this is a bug, then we could have the means to reproduce it. It is best to use test cases to reproduce the bug, so as to ensure that there will be no regression in the future.

@Hisoka-X
Copy link
Member

Thanks @liunaijie for update test case! I suggest use fake source connector to produce table with only table name. There are example https://github.com/apache/seatunnel/blob/cdfb5735acfbd281e01bf34393870fa573c5516c/docs/en/concept/schema-feature.md#table. It will be more simple and stable.

@Hisoka-X
Copy link
Member

image

@Hisoka-X Hisoka-X changed the title [fix][starrocks] fix NPE [Fix][StarRocks] Fix NPE when upstream catalogtable table path only have table name part Mar 28, 2024
Comment on lines 92 to 95
if (StringUtils.isNotBlank(sourceDatabaseName)) {
sinkDatabaseName =
sinkDatabaseName.replace(REPLACE_DATABASE_NAME_KEY, sourceDatabaseName);
}
Copy link
Member

Choose a reason for hiding this comment

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

I prefer when source database name is null, we can treat it as empty string.

Suggested change
if (StringUtils.isNotBlank(sourceDatabaseName)) {
sinkDatabaseName =
sinkDatabaseName.replace(REPLACE_DATABASE_NAME_KEY, sourceDatabaseName);
}
sinkDatabaseName = sinkDatabaseName.replace(REPLACE_DATABASE_NAME_KEY, sourceDatabaseName != null ? sourceDatabaseName: "");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Hisoka-X
Copy link
Member

Could you remind check other connector like doris/jdbc/file/s3 too (open another pr is fine)? Thanks
image

@liunaijie
Copy link
Contributor Author

Could you remind check other connector like doris/jdbc/file/s3 too (open another pr is fine)? Thanks image

ok, i will check other connectors. it will in another pr to fix if also has issue.

@Hisoka-X
Copy link
Member

Please fix ci

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 passed.

@hailin0 hailin0 merged commit 5795b26 into apache:dev Mar 29, 2024
4 checks passed
@liunaijie
Copy link
Contributor Author

Could you remind check other connector like doris/jdbc/file/s3 too (open another pr is fine)? Thanks image

I checked other connectors, they all have null value check.
But when i check the code, i find StarRocksCDCSinkIT is disabled, the disable reason is has some issue unfixed @Hisoka-X

@Hisoka-X
Copy link
Member

Hisoka-X commented Apr 1, 2024

Could you remind check other connector like doris/jdbc/file/s3 too (open another pr is fine)? Thanks image

I checked other connectors, they all have null value check. But when i check the code, i find StarRocksCDCSinkIT is disabled, the disable reason is has some issue unfixed @Hisoka-X

Yes, could you try to reopen it?

@liunaijie liunaijie deleted the hotfix-sr branch April 7, 2024 23:54
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.

[Bug] [StarRocks] Unable to create a sink for identifier 'StarRocks'.
4 participants