You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by xu...@apache.org on 2021/02/23 18:35:28 UTC

[hudi] branch master updated: [MINOR] hive sync checks for table after creating db if auto create is true (#2591)

This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b8d0f3  [MINOR] hive sync checks for table after creating db if auto create is true (#2591)
3b8d0f3 is described below

commit 3b8d0f3b1f368af8d3a38027d2ac82662ff9779f
Author: Ankush Kanungo <40...@users.noreply.github.com>
AuthorDate: Tue Feb 23 10:35:14 2021 -0800

    [MINOR] hive sync checks for table after creating db if auto create is true (#2591)
---
 .../src/main/java/org/apache/hudi/hive/HiveSyncTool.java             | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
index 5fd9c9c..47d4500 100644
--- a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
+++ b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
@@ -114,8 +114,6 @@ public class HiveSyncTool extends AbstractSyncTool {
   private void syncHoodieTable(String tableName, boolean useRealtimeInputFormat) {
     LOG.info("Trying to sync hoodie table " + tableName + " with base path " + hoodieHiveClient.getBasePath()
         + " of type " + hoodieHiveClient.getTableType());
-    // Check if the necessary table exists
-    boolean tableExists = hoodieHiveClient.doesTableExist(tableName);
 
     // check if the database exists else create it
     if (cfg.autoCreateDatabase) {
@@ -131,6 +129,9 @@ public class HiveSyncTool extends AbstractSyncTool {
       }
     }
 
+    // Check if the necessary table exists
+    boolean tableExists = hoodieHiveClient.doesTableExist(tableName);
+
     // Get the parquet schema for this table looking at the latest commit
     MessageType schema = hoodieHiveClient.getDataSchema();
     // Sync schema if needed