danny0405 commented on code in PR #8478:
URL: https://github.com/apache/hudi/pull/8478#discussion_r1201808001


##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/QueryBasedDDLExecutor.java:
##########
@@ -76,25 +77,37 @@ public QueryBasedDDLExecutor(HiveSyncConfig config) {
    */
   public abstract void runSQL(String sql);
 
+  /**
+   * Create a database with the given name.
+   */
   @Override
   public void createDatabase(String databaseName) {
-    runSQL("create database if not exists " + databaseName);
+    String createSQLQuery = 
HiveSchemaUtil.generateCreateDataBaseDDL(databaseName);
+    LOG.info("Creating database with {}.", createSQLQuery);
+    runSQL(createSQLQuery);
   }
 
+  /**
+   * Create a table with the given params.
+   */
   @Override
-  public void createTable(String tableName, MessageType storageSchema, String 
inputFormatClass, String outputFormatClass, String serdeClass, Map<String, 
String> serdeProperties,
-                          Map<String, String> tableProperties) {
+  public void createTable(String tableName, MessageType storageSchema, String 
inputFormatClass,
+      String outputFormatClass, String serdeClass, Map<String, String> 
serdeProperties,
+      Map<String, String> tableProperties) {
     try {
       String createSQLQuery =
-          HiveSchemaUtil.generateCreateDDL(tableName, storageSchema, config, 
inputFormatClass,
+          HiveSchemaUtil.generateCreateTableDDL(databaseName, tableName, 
storageSchema, config, inputFormatClass,
               outputFormatClass, serdeClass, serdeProperties, tableProperties);
-      LOG.info("Creating table with " + createSQLQuery);
+      LOG.info("Creating table with {}.", createSQLQuery);
       runSQL(createSQLQuery);
     } catch (IOException e) {
-      throw new HoodieHiveSyncException("Failed to create table " + tableName, 
e);
+      throw new HoodieHiveSyncException("Failed to create table " + 
tableId(databaseName, tableName), e);
     }
   }
 
+  /**
+   * Create a table with the given params.
+   */

Review Comment:
   Is the doc correct?



##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/QueryBasedDDLExecutor.java:
##########
@@ -113,6 +126,9 @@ public void updateTableDefinition(String tableName, 
MessageType newSchema) {
     }
   }
 
+  /**
+   * Create a table with the given params.
+   */

Review Comment:
   ditto



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