ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gna...@apache.org
Subject ambari git commit: AMBARI-19894. HiveView2.0 : View migration not working for new hive view. (gauravn7)
Date Wed, 08 Feb 2017 03:29:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 69ef28cf8 -> 24f4aa737


AMBARI-19894. HiveView2.0 : View migration not working for new hive view. (gauravn7)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/24f4aa73
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/24f4aa73
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/24f4aa73

Branch: refs/heads/branch-2.5
Commit: 24f4aa737b2620fab89873f11cecc1b9a46db23c
Parents: 69ef28c
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Wed Feb 8 08:58:01 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Wed Feb 8 08:59:06 2017 +0530

----------------------------------------------------------------------
 .../apache/ambari/view/hive20/DataMigrator.java  | 19 ++++++++++---------
 contrib/views/hive20/src/main/resources/view.xml |  2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/24f4aa73/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/DataMigrator.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/DataMigrator.java
b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/DataMigrator.java
index ae0a958..28d04a9 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/DataMigrator.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/DataMigrator.java
@@ -53,21 +53,22 @@ public class DataMigrator implements ViewDataMigrator {
   static
   {
     hive1EntitiesMapping = new HashMap<>();
-    hive1EntitiesMapping.put("org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl",
+
+    hive1EntitiesMapping.put("org.apache.ambari.view.hive2.resources.jobs.viewJobs.JobImpl",
         org.apache.ambari.view.hive20.resources.jobs.viewJobs.JobImpl.class);
-    hive1EntitiesMapping.put("org.apache.ambari.view.hive.resources.savedQueries.SavedQuery",
+    hive1EntitiesMapping.put("org.apache.ambari.view.hive2.resources.savedQueries.SavedQuery",
         org.apache.ambari.view.hive20.resources.savedQueries.SavedQuery.class);
-    hive1EntitiesMapping.put("org.apache.ambari.view.hive.resources.udfs.UDF",
+    hive1EntitiesMapping.put("org.apache.ambari.view.hive2.resources.udfs.UDF",
         org.apache.ambari.view.hive20.resources.udfs.UDF.class);
-    hive1EntitiesMapping.put("org.apache.ambari.view.hive.resources.resources.FileResourceItem",
+    hive1EntitiesMapping.put("org.apache.ambari.view.hive2.resources.resources.FileResourceItem",
         org.apache.ambari.view.hive20.resources.resources.FileResourceItem.class);
-    hive1EntitiesMapping.put("org.apache.ambari.view.hive.TestBean",
+    hive1EntitiesMapping.put("org.apache.ambari.view.hive2.TestBean",
         org.apache.ambari.view.hive20.TestBean.class);
   }
 
   @Override
   public boolean beforeMigration() throws ViewDataMigrationException {
-    return isHive1();
+    return isHive15();
   }
 
   @Override
@@ -76,7 +77,7 @@ public class DataMigrator implements ViewDataMigrator {
 
   @Override
   public void migrateEntity(Class originEntityClass, Class currentEntityClass) throws ViewDataMigrationException
{
-    if (isHive1()) {
+    if (isHive15()) {
       currentEntityClass = hive1EntitiesMapping.get(originEntityClass.getCanonicalName());
       if (currentEntityClass == null) {
         LOG.debug("Mapping was not found for class " + originEntityClass.getCanonicalName());
@@ -95,7 +96,7 @@ public class DataMigrator implements ViewDataMigrator {
     migrationContext.copyAllInstanceData();
   }
 
-  private boolean isHive1() {
-    return migrationContext.getOriginDataVersion() < 1;
+  private boolean isHive15() {
+    return migrationContext.getOriginDataVersion() == 1;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/24f4aa73/contrib/views/hive20/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/view.xml b/contrib/views/hive20/src/main/resources/view.xml
index 7cbe15c..0dd3875 100644
--- a/contrib/views/hive20/src/main/resources/view.xml
+++ b/contrib/views/hive20/src/main/resources/view.xml
@@ -22,7 +22,7 @@
 
     <min-ambari-version>2.0.*</min-ambari-version>
 
-    <data-version>1</data-version>
+    <data-version>2</data-version>
     <data-migrator-class>org.apache.ambari.view.hive20.DataMigrator</data-migrator-class>
 
     <validator-class>org.apache.ambari.view.hive20.PropertyValidator</validator-class>


Mime
View raw message