hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ekoif...@apache.org
Subject hive git commit: HIVE-18316 - HiveEndPoint should only work with full acid tables (Eugene Koifman, reviewed by Sergey Shelukhin)
Date Thu, 21 Dec 2017 04:12:06 GMT
Repository: hive
Updated Branches:
  refs/heads/master ed1cf112a -> 9dc02efae


HIVE-18316 - HiveEndPoint should only work with full acid tables (Eugene Koifman, reviewed
by Sergey Shelukhin)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9dc02efa
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9dc02efa
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9dc02efa

Branch: refs/heads/master
Commit: 9dc02efae9b6273309eb287534cfb413c9633141
Parents: ed1cf11
Author: Eugene Koifman <ekoifman@hortonworks.com>
Authored: Wed Dec 20 20:07:39 2017 -0800
Committer: Eugene Koifman <ekoifman@hortonworks.com>
Committed: Wed Dec 20 20:07:39 2017 -0800

----------------------------------------------------------------------
 .../apache/hive/hcatalog/streaming/HiveEndPoint.java | 15 +++++----------
 .../java/org/apache/hadoop/hive/ql/io/AcidUtils.java | 13 +++++++++++--
 2 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/9dc02efa/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
----------------------------------------------------------------------
diff --git a/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
b/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
index db3109e..bccf60c 100644
--- a/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
+++ b/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
@@ -21,7 +21,7 @@ package org.apache.hive.hcatalog.streaming;
 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 @@ public class HiveEndPoint {
         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<String, String> 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

http://git-wip-us.apache.org/repos/asf/hive/blob/9dc02efa/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
index 31316f0..bb105fe 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
@@ -1271,9 +1271,18 @@ public class AcidUtils {
    * {@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;


Mime
View raw message