diqiu50 commented on code in PR #4201:
URL: https://github.com/apache/gravitino/pull/4201#discussion_r1683710454
##########
trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogRegister.java:
##########
@@ -171,33 +171,34 @@ public void registerCatalog(String name, GravitinoCatalog
catalog) {
}
private boolean checkCatalogExist(String name) {
- String showCatalogCommand = String.format("SHOW CATALOGS like '%s'", name);
- Exception failedException = null;
- try {
- int retries = EXECUTE_QUERY_MAX_RETRIES;
- while (retries-- > 0) {
- try (Statement statement = connection.createStatement()) {
- // check the catalog is already created
- statement.execute(showCatalogCommand);
- ResultSet rs = statement.getResultSet();
- while (rs.next()) {
- String catalogName = rs.getString(1);
- if (catalogName.equals(name) || catalogName.equals("\"" + name +
"\"")) {
- return true;
- }
+ String showCatalogCommand = String.format("SHOW CATALOGS LIKE '%s'", name);
+ long endTime = System.currentTimeMillis() + EXECUTE_QUERY_TIMEOUT_MS;
+
+ do {
+ try (Statement statement = connection.createStatement();
+ ResultSet rs = statement.executeQuery(showCatalogCommand)) {
+
+ while (rs.next()) {
+ if (name.equalsIgnoreCase(rs.getString(1).replace("\"", ""))) {
Review Comment:
If the catalog name like 'catelog"xxx'. the check will be failed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]