Repository: hive Updated Branches: refs/heads/branch-2.1 0adb2255c -> cc5db0dcd
HIVE-13929 org.apache.hadoop.hive.metastore.api.DataOperationType class not found error when a job is submitted by hive (Eugene Koifman, reviewed by Ashutosh Chauhan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/cc5db0dc Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/cc5db0dc Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/cc5db0dc Branch: refs/heads/branch-2.1 Commit: cc5db0dcd17523e723aff5933dd6b95f1ef18f62 Parents: 0adb225 Author: Eugene Koifman <ekoif...@hortonworks.com> Authored: Thu Jun 2 20:41:48 2016 -0700 Committer: Eugene Koifman <ekoif...@hortonworks.com> Committed: Thu Jun 2 20:41:48 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hive/ql/io/AcidUtils.java | 32 +++++++++++++------- .../apache/hadoop/hive/ql/metadata/Hive.java | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/cc5db0dc/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 bac38ce..25055c2 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 @@ -223,17 +223,27 @@ public class AcidUtils { } public enum Operation { - NOT_ACID(DataOperationType.UNSET), - INSERT(DataOperationType.INSERT), - UPDATE(DataOperationType.UPDATE), - DELETE(DataOperationType.DELETE); - - private final DataOperationType dop; - private Operation(DataOperationType dop) { - this.dop = dop; - } - public DataOperationType toDataOperationType() { - return dop; + NOT_ACID, INSERT, UPDATE, DELETE; + } + + /** + * Logically this should have been defined in Operation but that causes a dependency + * on metastore package from exec jar (from the cluster) which is not allowed. + * This method should only be called from client side where metastore.* classes are present. + * Not following this will not be caught by unit tests since they have all the jar loaded. + */ + public static DataOperationType toDataOperationType(Operation op) { + switch (op) { + case NOT_ACID: + return DataOperationType.UNSET; + case INSERT: + return DataOperationType.INSERT; + case UPDATE: + return DataOperationType.UPDATE; + case DELETE: + return DataOperationType.DELETE; + default: + throw new IllegalArgumentException("Unexpected Operation: " + op); } } http://git-wip-us.apache.org/repos/asf/hive/blob/cc5db0dc/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index ee6c564..3a7d3bb 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -1760,7 +1760,7 @@ private void constructOneLBLocationMap(FileStatus fSta, partNames.add(p.getName()); } metaStoreClient.addDynamicPartitions(txnId, tbl.getDbName(), tbl.getTableName(), - partNames, operation.toDataOperationType()); + partNames, AcidUtils.toDataOperationType(operation)); } return partitionsMap; } catch (IOException e) {