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

sivabalan 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 d5ef8a39b8 [HUDI-5074] Warn if table for metastore sync has capitals 
in it (#7077)
d5ef8a39b8 is described below

commit d5ef8a39b8bd997325be18eda71d3ca619b6e12f
Author: Jon Vexler <[email protected]>
AuthorDate: Tue Nov 1 22:25:02 2022 -0400

    [HUDI-5074] Warn if table for metastore sync has capitals in it (#7077)
    
    
    Co-authored-by: Jonathan Vexler <=>
---
 .../java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
 
b/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
index 1427eb2887..57db00ab98 100644
--- 
a/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
+++ 
b/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
@@ -27,6 +27,8 @@ import org.apache.hudi.sync.common.HoodieSyncTool;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
 
 import java.util.Properties;
 
@@ -34,7 +36,7 @@ import java.util.Properties;
  * Helper class for syncing Hudi commit data with external metastores.
  */
 public class SyncUtilHelpers {
-
+  private static final Logger LOG = 
LogManager.getLogger(SyncUtilHelpers.class);
   /**
    * Create an instance of an implementation of {@link HoodieSyncTool} that 
will sync all the relevant meta information
    * with an external metastore such as Hive etc. to ensure Hoodie tables can 
be queried or read via external systems.
@@ -69,6 +71,10 @@ public class SyncUtilHelpers {
     properties.putAll(props);
     properties.put(HoodieSyncConfig.META_SYNC_BASE_PATH.key(), targetBasePath);
     properties.put(HoodieSyncConfig.META_SYNC_BASE_FILE_FORMAT.key(), 
baseFileFormat);
+    String tableName = 
properties.getString(HoodieSyncConfig.META_SYNC_TABLE_NAME.key());
+    if (!tableName.equals(tableName.toLowerCase())) {
+      LOG.warn("Table name \"" + tableName + "\" contains capital letters. 
Your metastore may automatically convert this to lower case and can cause table 
not found errors during subsequent syncs.");
+    }
 
     if (ReflectionUtils.hasConstructor(syncToolClassName,
         new Class<?>[] {Properties.class, Configuration.class})) {

Reply via email to