[
https://issues.apache.org/jira/browse/HIVE-26474?focusedWorklogId=803646&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-803646
]
ASF GitHub Bot logged work on HIVE-26474:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Aug/22 13:52
Start Date: 25/Aug/22 13:52
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #3550:
URL: https://github.com/apache/hive/pull/3550#discussion_r954997081
##########
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:
was it copied from UpgradeTool.canBeMadeAcid()? can we extract this to some
common place to avoid code duplication?
Issue Time Tracking
-------------------
Worklog Id: (was: 803646)
Time Spent: 1.5h (was: 1h 20m)
> Enable converting insert-only tables to full ACID tables
> --------------------------------------------------------
>
> Key: HIVE-26474
> URL: https://issues.apache.org/jira/browse/HIVE-26474
> Project: Hive
> Issue Type: Improvement
> Reporter: Simhadri Govindappa
> Assignee: Simhadri Govindappa
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> Currently we can convert a non-ACID table to full ACID via altering
> TBLPROPERTIES ("transactional"="false" -> "transactional"="true"), but we
> don't support converting insert-only tables to full ACID tables
> ("transactional_properties"="insert_only" - >
> "transactional_properties"="default").
--
This message was sent by Atlassian Jira
(v8.20.10#820010)