You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/08/25 17:43:31 UTC

[GitHub] [hive] simhadri-g commented on a diff in pull request #3550: HIVE-26474: Enable converting insert-only tables to full ACID tables

simhadri-g commented on code in PR #3550:
URL: https://github.com/apache/hive/pull/3550#discussion_r955254804


##########
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java:
##########
@@ -2265,6 +2268,50 @@ public static Boolean isToInsertOnlyTable(Table tbl, Map<String, String> props)
     return true;
   }
 
+  public static Boolean isToFullAcid(Table table, Map<String, String> props) {
+    String transactional = props.get(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL);
+    String transactionalProp = props.get(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES);
+
+    if (transactional == null && transactionalProp == null) {
+      // Not affected or the op is not about transactional.
+      return false;
+    } else if (transactional == null && table != null) {
+      transactional = table.getParameters().get(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL);
+    }
+
+    if (transactionalProp == null) {
+      boolean isSetToTxn = "true".equalsIgnoreCase(transactional);
+      if (isSetToTxn || table == null) return false; // Assume the full ACID table.
+      throw new RuntimeException("Cannot change '" + hive_metastoreConstants.TABLE_IS_TRANSACTIONAL
+              + "' without '" + hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES + "'");
+    }
+
+    StorageDescriptor sd = table.getSd();
+    return isStorageDescriptorOrc(sd, table.getTableName());
+  }
+
+
+  private static boolean isStorageDescriptorOrc(StorageDescriptor sd, String tblName) {

Review Comment:
   Moved it to AcidUtils.



-- 
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-unsubscribe@hive.apache.org

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


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