diff --git hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java index db3109e069..bccf60c3bd 100644 --- hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java +++ hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java @@ -21,7 +21,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.hive.common.JavaUtils; import org.apache.hadoop.hive.metastore.api.DataOperationType; -import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.ql.io.AcidUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.hive.cli.CliSessionState; @@ -336,15 +336,10 @@ private void checkEndPoint(HiveEndPoint endPoint, IMetaStoreClient msClient) LOG.warn("Unable to check the endPoint: " + endPoint, e); throw new InvalidTable(endPoint.database, endPoint.table, e); } - - // 1 - check if TBLPROPERTIES ('transactional'='true') is set on table - Map params = t.getParameters(); - if (params != null) { - String transactionalProp = params.get(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL); - if (transactionalProp == null || !transactionalProp.equalsIgnoreCase("true")) { - LOG.error("'transactional' property is not set on Table " + endPoint); - throw new InvalidTable(endPoint.database, endPoint.table, "\'transactional\' property" + - " is not set on Table"); } + // 1 - check that the table is Acid + if (!AcidUtils.isAcidTable(t)) { + LOG.error("HiveEndPoint " + endPoint + " must use an acid table"); + throw new InvalidTable(endPoint.database, endPoint.table, "is not an Acid table"); } // 2 - check if partitionvals are legitimate diff --git ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java index 31316f0f89..bb105fe6ce 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java @@ -1271,9 +1271,18 @@ public static boolean isTransactionalTable(CreateTableDesc table) { * {@link org.apache.hadoop.hive.metastore.txn.TxnUtils#isAcidTable(org.apache.hadoop.hive.metastore.api.Table)} */ public static boolean isAcidTable(Table table) { - return isTransactionalTable(table) && !AcidUtils.isInsertOnlyTable(table); + return isAcidTable(table == null ? null : table.getTTable()); } - + /** + * Should produce the same result as + * {@link org.apache.hadoop.hive.metastore.txn.TxnUtils#isAcidTable(org.apache.hadoop.hive.metastore.api.Table)} + */ + public static boolean isAcidTable(org.apache.hadoop.hive.metastore.api.Table table) { + return table != null && table.getParameters() != null && + isTablePropertyTransactional(table.getParameters()) && + !isInsertOnlyTable(table.getParameters()); + } + public static boolean isAcidTable(CreateTableDesc td) { if (td == null || td.getTblProps() == null) { return false;