deniskuzZ commented on code in PR #3822:
URL: https://github.com/apache/hive/pull/3822#discussion_r1060425386


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java:
##########
@@ -1143,15 +1143,26 @@ public static TableName getTableNameFor(Table table) {
   /**
    * Because TABLE_NO_AUTO_COMPACT was originally assumed to be 
NO_AUTO_COMPACT and then was moved
    * to no_auto_compact, we need to check it in both cases.
+   * Check the database level no_auto_compact , if present it is given 
priority else table level no_auto_compact is considered.
    */
-  public static boolean isNoAutoCompactSet(Map<String, String> parameters) {
-    String noAutoCompact =
-            parameters.get(hive_metastoreConstants.TABLE_NO_AUTO_COMPACT);
+  public static boolean isNoAutoCompactSet(Map<String, String> dbParameters, 
Map<String, String> tblParameters) {
+    String dbNoAutoCompact = getNoAutoCompact(dbParameters);
+    if (dbNoAutoCompact == null) {
+      LOG.debug("Using table configuration '" + 
hive_metastoreConstants.TABLE_NO_AUTO_COMPACT + "' for compaction");
+      String noAutoCompact = getNoAutoCompact(tblParameters);
+      return noAutoCompact != null && noAutoCompact.equalsIgnoreCase("true");
+    }
+    LOG.debug("Using database configuration '" + 
hive_metastoreConstants.TABLE_NO_AUTO_COMPACT + "' for compaction");
+    return dbNoAutoCompact.equalsIgnoreCase("true");
+  }
+
+  // Get no_auto_compact property by checking in both lower and upper cases
+  private static String getNoAutoCompact(Map<String, String> parameters) {

Review Comment:
   can we return boolean right away?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to