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

[Core] remove duplicated schema names in list schema in JDBC catalog #4440

Merged
merged 3 commits into from
Nov 9, 2024

Conversation

FANNG1
Copy link
Contributor

@FANNG1 FANNG1 commented Nov 4, 2024

Purpose

fixes: #4439

@@ -155,7 +156,8 @@ public List<String> listDatabases() {
row -> row.getString(JdbcUtils.DATABASE_NAME),
JdbcUtils.LIST_ALL_PROPERTY_DATABASES_SQL,
catalogKey));
return databases;

return databases.stream().distinct().collect(Collectors.toList());

Choose a reason for hiding this comment

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

I am curious what the root cause of this is.
Why does databases contain the duplicate - is it ever valid?
Are there other implications to leaving this list with duplicates?
Would it not be better to fix this when the duplicate was added?
Also it would be good to add a junit.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 curious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two tables in JDBC catalog, paimon_database_properties contains database properties, paimon_tables contains table , schema, catalog relations. The same database will present in these two tables if creating a database and tables because Paimon will automatically add some properties when creating schema.
@davidradl do you have any suggestion where to place the test?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JingsongLi @davidradl add a test, please help to review again.

@wwj6591812
Copy link
Contributor

+1

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit b8a4def into apache:master Nov 9, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] JDBC catalog may produce duplicated schema names when calling list schema
4 participants