yuanoOo commented on code in PR #5013:
URL: https://github.com/apache/gravitino/pull/5013#discussion_r1776211821


##########
catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseDatabaseOperations.java:
##########
@@ -45,17 +55,62 @@ private static Set<String> 
createSysOceanBaseDatabaseNames() {
   public String generateCreateDatabaseSql(
       String databaseName, String comment, Map<String, String> properties) {
 
-    throw new UnsupportedOperationException("Not implemented yet.");
+    String originComment = StringIdentifier.removeIdFromComment(comment);

Review Comment:
   I checked and found that PG and Doris do not have the logic of 
`StringIdentifier.addToComment(identifier, comment)`.
   
   I tried refactoring the code for reuse:
   ```
     /**
      * @param databaseName The name of the database.
      * @param comment The comment of the database.
      * @param properties The properties of the database.
      * @return the SQL statement to create a database with the given name and 
comment.
      */
     protected String generateCreateDatabaseSql(
         String databaseName, String comment, Map<String, String> properties) {
       String originComment = StringIdentifier.removeIdFromComment(comment);
       return generateCreateDatabaseSql(databaseName, comment, originComment, 
properties);
     }
   
     protected String generateCreateDatabaseSql(
             String databaseName, String comment, String originComment, 
Map<String, String> properties) {
       throw new UnsupportedOperationException("");
     };
   ```
   - In this way, there is no need to change the code of PG and Doris modules.
   - Oceanbase and MySQL can choose to override the newly added methods: 
`protected String generateCreateDatabaseSql(String databaseName, String 
comment, String originComment, Map<String, String> properties) `
   
   I don't think there is much need. what do you think?
   



-- 
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]

Reply via email to