You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by gn...@apache.org on 2017/01/03 08:37:31 UTC

[5/5] ambari git commit: AMBARI-19168 Supports udf migration for hive and pig migration and multi-user select for all migrations. (Ishan Bhatt via gauravn7)

AMBARI-19168 Supports udf migration for hive and pig migration and multi-user select for all migrations. (Ishan Bhatt via gauravn7)


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

Branch: refs/heads/branch-2.5
Commit: bea5ebb8ef725904f300c6757245703872f30f1d
Parents: bd7ac32
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Tue Jan 3 14:04:22 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Tue Jan 3 14:06:39 2017 +0530

----------------------------------------------------------------------
 .../savedqueryset/MysqlQuerySetAmbariDB.java    |  30 +-
 .../savedqueryset/OracleQuerySetAmbariDB.java   |  29 +-
 .../hive/savedqueryset/QuerySetAmbariDB.java    |  76 +++-
 .../pig/udfqueryset/MysqlQuerySetAmbariDB.java  |  48 +++
 .../pig/udfqueryset/OracleQuerySetAmbariDB.java |  46 +++
 .../udfqueryset/PostgressQuerySetAmbariDB.java  |  22 ++
 .../pig/udfqueryset/QuerySetAmbariDB.java       |  82 ++++
 .../hive/historyqueryset/MysqlQuerySet.java     |  23 --
 .../historyqueryset/MysqlQuerySetHueDB.java     |  23 ++
 .../hive/historyqueryset/OracleQuerySet.java    |  61 ---
 .../historyqueryset/OracleQuerySetHueDB.java    |  66 ++++
 .../hive/historyqueryset/PostgressQuerySet.java |  22 --
 .../historyqueryset/PostgressQuerySetHueDB.java |  22 ++
 .../hive/historyqueryset/QuerySet.java          | 130 -------
 .../hive/historyqueryset/QuerySetHueDB.java     | 139 +++++++
 .../hive/historyqueryset/SqliteQuerySet.java    |  22 --
 .../historyqueryset/SqliteQuerySetHueDB.java    |  22 ++
 .../hive/savedqueryset/MysqlQuerySet.java       |  23 --
 .../hive/savedqueryset/MysqlQuerySetHueDb.java  |  23 ++
 .../hive/savedqueryset/OracleQuerySet.java      |  65 ----
 .../hive/savedqueryset/OracleQuerySetHueDb.java |  71 ++++
 .../hive/savedqueryset/PostgressQuerySet.java   |  22 --
 .../savedqueryset/PostgressQuerySetHueDb.java   |  22 ++
 .../hive/savedqueryset/QuerySet.java            | 134 -------
 .../hive/savedqueryset/QuerySetHueDb.java       | 144 +++++++
 .../hive/savedqueryset/SqliteQuerySet.java      |  22 --
 .../hive/savedqueryset/SqliteQuerySetHueDb.java |  22 ++
 .../pig/jobqueryset/MysqlQuerySet.java          |  22 --
 .../pig/jobqueryset/MysqlQuerySetHueDb.java     |  22 ++
 .../pig/jobqueryset/OracleQuerySet.java         |  65 ----
 .../pig/jobqueryset/OracleQuerySetHueDb.java    |  69 ++++
 .../pig/jobqueryset/PostgressQuerySet.java      |  22 --
 .../pig/jobqueryset/PostgressQuerySetHueDb.java |  22 ++
 .../huequeryset/pig/jobqueryset/QuerySet.java   | 132 -------
 .../pig/jobqueryset/QuerySetHueDb.java          | 141 +++++++
 .../pig/jobqueryset/SqliteQuerySet.java         |  22 --
 .../pig/jobqueryset/SqliteQuerySetHueDb.java    |  22 ++
 .../pig/savedscriptqueryset/MysqlQuerySet.java  |  22 --
 .../savedscriptqueryset/MysqlQuerySetHueDb.java |  22 ++
 .../pig/savedscriptqueryset/OracleQuerySet.java |  60 ---
 .../OracleQuerySetHueDb.java                    |  64 +++
 .../savedscriptqueryset/PostgressQuerySet.java  |  67 ----
 .../PostgressQuerySetHueDb.java                 |  67 ++++
 .../pig/savedscriptqueryset/QuerySet.java       | 135 -------
 .../pig/savedscriptqueryset/QuerySetHueDb.java  | 142 +++++++
 .../pig/savedscriptqueryset/SqliteQuerySet.java |  24 --
 .../SqliteQuerySetHueDb.java                    |  24 ++
 .../pig/udfqueryset/MysqlQuerySet.java          |  22 ++
 .../pig/udfqueryset/OracleQuerySet.java         |  41 ++
 .../pig/udfqueryset/PostgressQuerySet.java      |  23 ++
 .../huequeryset/pig/udfqueryset/QuerySet.java   |  75 ++++
 .../pig/udfqueryset/SqliteQuerySet.java         |  24 ++
 .../migration/InitiateJobMigration.java         |   5 +
 .../HiveHistoryMigrationUtility.java            | 154 ++++----
 ...HiveHistoryQueryMigrationImplementation.java |  34 +-
 .../hive/historyquery/HiveHistoryStartJob.java  |   1 +
 .../HiveSavedQueryMigrationImplementation.java  | 117 ++++--
 .../HiveSavedQueryMigrationUtility.java         | 191 +++++----
 .../hive/savedquery/HiveSavedQueryStartJob.java |   1 +
 .../pigjob/PigJobMigrationImplementation.java   |  42 +-
 .../pig/pigjob/PigJobMigrationUtility.java      | 358 ++++++++---------
 .../migration/pig/pigjob/PigJobStartJob.java    |   1 +
 .../pig/pigscript/PigSavedScriptStartJob.java   |   1 +
 .../PigScriptMigrationImplementation.java       |  36 +-
 .../pigscript/PigScriptMigrationUtility.java    | 136 ++++---
 .../pigudf/PigUdfMigrationImplementation.java   | 387 +++++++++++++++++++
 .../pig/pigudf/PigUdfMigrationUtility.java      | 235 +++++++++++
 .../migration/pig/pigudf/PigUdfStartJob.java    |  69 ++++
 .../resources/scripts/models/HiveModel.java     |  48 ++-
 .../scripts/models/MigrationResponse.java       |   6 +-
 .../resources/scripts/models/PigModel.java      |  20 +
 .../app/models/checkprogress.js                 |   3 +-
 .../ui/hueambarimigration-view/app/router.js    |   2 +-
 .../app/routes/home-page/hive-history.js        |  45 ++-
 .../app/routes/home-page/hive-saved-query.js    |  44 ++-
 .../app/routes/home-page/pig-job.js             |  45 ++-
 .../app/routes/home-page/pig-script.js          |  45 ++-
 .../app/routes/home-page/pig-udf.js             | 121 ++++++
 .../app/templates/home-page.hbs                 |   5 +-
 .../app/templates/home-page/hive-history.hbs    |   4 +-
 .../templates/home-page/hive-saved-query.hbs    |   4 +-
 .../app/templates/home-page/pig-job.hbs         |   4 +-
 .../app/templates/home-page/pig-script.hbs      |   4 +-
 .../app/templates/home-page/pig-udf.hbs         | 109 ++++++
 84 files changed, 3407 insertions(+), 1632 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java
index 204ace9..691df89 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java
@@ -29,10 +29,11 @@ public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB {
   }
 
   @Override
-  protected String getTableIdSqlFromInstanceNameSavedQuery() {
-    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.%hive%.resources.savedQueries.SavedQuery' and view_instance_name=?;";
+  protected String getTableIdSqlFromInstanceName(String sequence) {
+    return "select id from viewentity where class_name LIKE '" + sequence + "' and view_instance_name=?;";
   }
 
+
   @Override
   protected String getSqlMaxDSidFromTableIdHistoryQuery(int id) {
     return "select MAX(cast(ds_id as integer)) as max from DS_JOBIMPL_" + id + ";";
@@ -54,6 +55,16 @@ public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB {
   }
 
   @Override
+  protected String getSqlInsertFileResources(int id) {
+    return "INSERT INTO DS_FILERESOURCEITEM_" + id + " values (?,?,?,?);";
+  }
+
+  @Override
+  protected String getSqlInsertHiveUdf(int id) {
+    return "INSERT INTO DS_UDF_" + id + " values (?,?,?,?,?);";
+  }
+
+  @Override
   protected String getRevSqlSavedQuery(int id, String maxcount) {
     return "delete from  DS_SAVEDQUERY_" + id + " where ds_id='" + maxcount + "';";
   }
@@ -62,12 +73,19 @@ public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB {
   protected String getRevSqlHistoryQuery(int id, String maxcount) {
     return "delete from  DS_JOBIMPL_" + id + " where ds_id='" + maxcount + "';";
   }
+
+  @Override
+  protected String getSqlSequenceNoFromAmbariSequence() {
+    return "select sequence_value from ambari_sequences where sequence_name=?;";
+  }
+
   @Override
-  protected String getSqlSequenceNoFromAmbariSequence(int id) {
-    return "select sequence_value from ambari_sequences where sequence_name ='ds_savedquery_"+id+"_id_seq';";
+  protected String getSqlUpdateSequenceNo() {
+    return "update ambari_sequences set sequence_value=? where sequence_name=?;";
   }
+
   @Override
-  protected String getSqlUpdateSequenceNo(int id) {
-    return "update ambari_sequences set sequence_value=? where sequence_name='ds_savedquery_"+id+"_id_seq';";
+  protected String getSqlUdfFileNameAndOwners(int id) {
+    return "select ds_name, ds_owner from ds_fileresourceitem_" + id + ";";
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java
index 5efcc1c..522deec 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java
@@ -25,8 +25,8 @@ public class OracleQuerySetAmbariDB extends QuerySetAmbariDB {
   }
 
   @Override
-  protected String getTableIdSqlFromInstanceNameSavedQuery() {
-    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.savedQueries.SavedQuery' and view_instance_name=?";
+  protected String getTableIdSqlFromInstanceName(String sequence) {
+    return "select id from viewentity where class_name LIKE '" + sequence + "' and view_instance_name=?";
   }
 
   @Override
@@ -48,6 +48,16 @@ public class OracleQuerySetAmbariDB extends QuerySetAmbariDB {
   }
 
   @Override
+  protected String getSqlInsertFileResources(int id) {
+    return "INSERT INTO ds_fileresourceitem_" + id + " values (?,?,?,?)";
+  }
+
+  @Override
+  protected String getSqlInsertHiveUdf(int id) {
+    return "INSERT INTO ds_udf_" + id + " values (?,?,?,?,?)";
+  }
+
+  @Override
   protected String getRevSqlSavedQuery(int id, String maxcount) {
     return "delete from  ds_savedquery_" + id + " where ds_id='" + maxcount + "'";
   }
@@ -55,12 +65,19 @@ public class OracleQuerySetAmbariDB extends QuerySetAmbariDB {
   protected String getRevSqlHistoryQuery(int id, String maxcount) {
     return "delete from  ds_jobimpl_" + id + " where ds_id='" + maxcount + "'";
   }
+
   @Override
-  protected String getSqlSequenceNoFromAmbariSequence(int id) {
-    return "select sequence_value from ambari_sequences where sequence_name ='ds_savedquery_"+id+"_id_seq'";
+  protected String getSqlSequenceNoFromAmbariSequence() {
+    return "select sequence_value from ambari_sequences where sequence_name=?;";
   }
+
+  @Override
+  protected String getSqlUpdateSequenceNo() {
+    return "update ambari_sequences set sequence_value=? where sequence_name=?;";
+  }
+
   @Override
-  protected String getSqlUpdateSequenceNo(int id) {
-    return "update ambari_sequences set sequence_value=? where sequence_name='ds_savedquery_"+id+"_id_seq'";
+  protected String getSqlUdfFileNameAndOwners(int id) {
+    return "select ds_name, ds_owner from ds_fileresourceitem_" + id + ";";
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java
index 3bfe73d..5d928b6 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java
@@ -27,24 +27,30 @@ import java.sql.SQLException;
 
 public abstract class QuerySetAmbariDB {
 
-  public PreparedStatement getTableIdFromInstanceNameSavedquery(Connection connection, String instance) throws SQLException {
+  public PreparedStatement getTableIdFromInstanceName(Connection connection, String instance, String tableSequence) throws SQLException {
 
-    PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceNameSavedQuery());
+    PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceName(tableSequence));
     prSt.setString(1, instance);
     return prSt;
   }
 
-  public PreparedStatement updateSequenceNoInAmbariSequence(Connection connection, int seqNo, int id) throws SQLException {
 
-    PreparedStatement prSt = connection.prepareStatement(getSqlUpdateSequenceNo(id));
+  public PreparedStatement updateSequenceNoInAmbariSequence(Connection connection, int seqNo, String sequenceName) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlUpdateSequenceNo());
 
     prSt.setInt(1, seqNo);
+    prSt.setString(2, sequenceName);
 
     return prSt;
   }
 
-  public PreparedStatement getSequenceNoFromAmbariSequence(Connection connection,int id) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(getSqlSequenceNoFromAmbariSequence(id));
+  public PreparedStatement getSequenceNoFromAmbariSequence(Connection connection,String sequenceName) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlSequenceNoFromAmbariSequence());
+
+    prSt.setString(1, sequenceName);
+
     return prSt;
   }
 
@@ -101,6 +107,39 @@ public abstract class QuerySetAmbariDB {
     return prSt;
   }
 
+
+  public PreparedStatement insertToFileResources(Connection connection, int id, String maxcount, String fileName, String udfOwner, String udfPath) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlInsertFileResources(id));
+
+    prSt.setString(1, maxcount);
+    prSt.setString(2, fileName);
+    prSt.setString(3, udfOwner);
+    prSt.setString(4, udfPath);
+
+    return prSt;
+
+  }
+
+  public PreparedStatement insertToHiveUdf(Connection connection, int id, String maxcount1, String maxcount2, String className, String name, String owner) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlInsertHiveUdf(id));
+
+    prSt.setString(1, maxcount1);
+    prSt.setString(2, className);
+    prSt.setString(3, maxcount2);
+    prSt.setString(4, name);
+    prSt.setString(5, owner);
+
+    return prSt;
+  }
+
+  public PreparedStatement getUdfFileNamesAndOwners(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(getSqlUdfFileNameAndOwners(id));
+    return prSt;
+
+  }
+
   public String revertSqlHistoryQuery(int id, String maxcount) throws SQLException {
 
     return getRevSqlHistoryQuery(id, maxcount);
@@ -115,10 +154,11 @@ public abstract class QuerySetAmbariDB {
     return "select MAX(cast(ds_id as integer)) as max from ds_savedquery_" + id + ";";
   }
 
-  protected String getTableIdSqlFromInstanceNameSavedQuery() {
-    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.%hive%.resources.savedQueries.SavedQuery' and view_instance_name=?;";
+  protected String getTableIdSqlFromInstanceName(String sequence) {
+    return "select id from viewentity where class_name LIKE '" + sequence + "' and view_instance_name=?;";
   }
 
+
   protected String getSqlMaxDSidFromTableIdHistoryQuery(int id) {
     return "select MAX(cast(ds_id as integer)) as max from ds_jobimpl_" + id + ";";
   }
@@ -135,6 +175,14 @@ public abstract class QuerySetAmbariDB {
     return "INSERT INTO ds_savedquery_" + id + " values (?,?,?,?,?,?);";
   }
 
+  protected String getSqlInsertFileResources(int id) {
+    return "INSERT INTO ds_fileresourceitem_" + id + " values (?,?,?,?);";
+  }
+
+  protected String getSqlInsertHiveUdf(int id) {
+    return "INSERT INTO ds_udf_" + id + " values (?,?,?,?,?);";
+  }
+
   protected String getRevSqlSavedQuery(int id, String maxcount) {
     return "delete from  ds_savedquery_" + id + " where ds_id='" + maxcount + "';";
   }
@@ -143,12 +191,16 @@ public abstract class QuerySetAmbariDB {
     return "delete from  ds_jobimpl_" + id + " where ds_id='" + maxcount + "';";
   }
 
-  protected String getSqlSequenceNoFromAmbariSequence(int id) {
-    return "select sequence_value from ambari_sequences where sequence_name ='ds_savedquery_"+id+"_id_seq';";
+  protected String getSqlSequenceNoFromAmbariSequence() {
+    return "select sequence_value from ambari_sequences where sequence_name=?;";
+  }
+
+  protected String getSqlUpdateSequenceNo() {
+    return "update ambari_sequences set sequence_value=? where sequence_name=?;";
   }
 
-  protected String getSqlUpdateSequenceNo(int id) {
-    return "update ambari_sequences set sequence_value=? where sequence_name='ds_savedquery_"+id+"_id_seq';";
+  protected String getSqlUdfFileNameAndOwners(int id) {
+    return "select ds_name, ds_owner from ds_fileresourceitem_" + id + ";";
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/MysqlQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/MysqlQuerySetAmbariDB.java
new file mode 100644
index 0000000..47203c9
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/MysqlQuerySetAmbariDB.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset;
+
+/**
+ * over rides method for Mysql specific queries
+ */
+
+public class MysqlQuerySetAmbariDB extends org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.QuerySetAmbariDB {
+
+  @Override
+  protected String getSqlMaxDSidFromTableId(int id) {
+    return "select max( cast(ds_id as unsigned) ) as max from DS_UDF_" + id + ";";
+  }
+  @Override
+  protected String getTableIdSqlFromInstanceName() {
+    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.udf.models.UDF' and view_instance_name=?;";
+  }
+  @Override
+  protected String getSqlinsertToPigUdf(int id) {
+    return  "INSERT INTO DS_UDF_" + id + " values (?,?,?,?);";
+  }
+
+  @Override
+  protected String getSqlSequenceNoFromAmbariSequence(int id) {
+    return "select sequence_value from ambari_sequences where sequence_name ='ds_udf_"+id+"_id_seq';";
+  }
+  @Override
+  protected String getSqlUpdateSequenceNo(int id) {
+    return "update ambari_sequences set sequence_value=? where sequence_name='ds_udf"+id+"_id_seq';";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/OracleQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/OracleQuerySetAmbariDB.java
new file mode 100644
index 0000000..9ac4540
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/OracleQuerySetAmbariDB.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset;
+
+public class OracleQuerySetAmbariDB extends QuerySetAmbariDB {
+  /*
+  * Overriding methods for Oracle specific queries
+  * */
+  @Override
+  protected String getSqlMaxDSidFromTableId(int id) {
+    return "select MAX(cast(ds_id as integer)) as max from ds_udf_" + id + "";
+  }
+  @Override
+  protected String getTableIdSqlFromInstanceName() {
+    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.udf.models.UDF' and view_instance_name=?";
+  }
+  @Override
+  protected String getSqlinsertToPigUdf(int id) {
+    return "INSERT INTO ds_udf_" + id + " values (?,?,?,?)";
+  }
+
+  @Override
+  protected String getSqlSequenceNoFromAmbariSequence(int id) {
+    return "select sequence_value from ambari_sequences where sequence_name ='ds_udf_"+id+"_id_seq'";
+  }
+  @Override
+  protected String getSqlUpdateSequenceNo(int id) {
+    return "update ambari_sequences set sequence_value=? where sequence_name='ds_udf_"+id+"_id_seq'";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/PostgressQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/PostgressQuerySetAmbariDB.java
new file mode 100644
index 0000000..47d98fd
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/PostgressQuerySetAmbariDB.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset;
+
+
+public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/QuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/QuerySetAmbariDB.java
new file mode 100644
index 0000000..85dac1c
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/udfqueryset/QuerySetAmbariDB.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+/**
+ * Pig Script prepared statement
+ */
+public abstract class QuerySetAmbariDB {
+
+  public PreparedStatement getTableIdFromInstanceName(Connection connection, String instance) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceName());
+    prSt.setString(1, instance);
+    return prSt;
+  }
+
+  public PreparedStatement getSequenceNoFromAmbariSequence(Connection connection,int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(getSqlSequenceNoFromAmbariSequence(id));
+    return prSt;
+  }
+
+
+  public PreparedStatement insertToPigUdf(Connection connection, int id, String maxcount1, String udfName, String owner,String path) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlinsertToPigUdf(id));
+    prSt.setString(1, maxcount1);
+    prSt.setString(2, udfName);
+    prSt.setString(3, owner);
+    prSt.setString(4, path);
+
+    return prSt;
+  }
+
+
+  public PreparedStatement updateSequenceNoInAmbariSequence(Connection connection, int seqNo, int id) throws SQLException {
+
+    PreparedStatement prSt = connection.prepareStatement(getSqlUpdateSequenceNo(id));
+
+    prSt.setInt(1, seqNo);
+
+    return prSt;
+  }
+
+  protected String getSqlMaxDSidFromTableId(int id) {
+    return "select MAX(cast(ds_id as integer)) as max from ds_udf_" + id + ";";
+  }
+
+  protected String getTableIdSqlFromInstanceName() {
+    return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.udf.models.UDF' and view_instance_name=?;";
+  }
+
+  protected String getSqlinsertToPigUdf(int id) {
+    return "INSERT INTO ds_udf_" + id + " values (?,?,?,?);";
+  }
+
+
+  protected String getSqlSequenceNoFromAmbariSequence(int id) {
+    return "select sequence_value from ambari_sequences where sequence_name ='ds_udf_"+id+"_id_seq';";
+  }
+
+  protected String getSqlUpdateSequenceNo(int id) {
+    return "update ambari_sequences set sequence_value=? where sequence_name='ds_udf_"+id+"_id_seq';";
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java
deleted file mode 100644
index d379f88..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
-
-
-public class MysqlQuerySet extends QuerySet {
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySetHueDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySetHueDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySetHueDB.java
new file mode 100644
index 0000000..4a81579
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySetHueDB.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
+
+
+public class MysqlQuerySetHueDB extends QuerySetHueDB {
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java
deleted file mode 100644
index 4afb222..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
-
-
-public class OracleQuerySet extends QuerySet {
-
-  @Override
-  protected String fetchuserIdfromUsernameSql() {
-    return "select id from auth_user where username=?";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =?";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?)";
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?)";
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?)";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date <= date(?)";
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date >= date(?)";
-
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?)";
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySetHueDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySetHueDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySetHueDB.java
new file mode 100644
index 0000000..32edde4
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySetHueDB.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
+
+
+public class OracleQuerySetHueDB extends QuerySetHueDB {
+
+  @Override
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select query from beeswax_queryhistory where owner_id =?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select query from beeswax_queryhistory";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select query from beeswax_queryhistory where submission_date <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select query from beeswax_queryhistory where submission_date >= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?)";
+
+  }
+  @Override
+  protected String fetchUserNamSql() {
+    return "select username from auth_user where id = ?";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java
deleted file mode 100644
index 829582a..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
-
-
-public class PostgressQuerySet extends QuerySet {
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySetHueDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySetHueDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySetHueDB.java
new file mode 100644
index 0000000..f303aa7
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySetHueDB.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
+
+
+public class PostgressQuerySetHueDB extends QuerySetHueDB {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java
deleted file mode 100644
index 8d2aad4..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-
-public abstract class QuerySet {
-
-
-  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
-    prSt.setString(1, username);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
-    prSt.setInt(1, id);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, enddate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, startdate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, startdate);
-    prSt.setString(3, endate);
-    return prSt;
-  }
-
-  /**
-   * for all user
-   */
-  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
-    prSt.setString(1, enddate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
-    prSt.setString(1, startdate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
-    prSt.setString(1, startdate);
-    prSt.setString(2, endate);
-    return prSt;
-  }
-
-
-  protected String fetchuserIdfromUsernameSql() {
-    return "select id from auth_user where username=?;";
-
-  }
-
-  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =?;";
-  }
-
-  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?);";
-  }
-
-  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?);";
-  }
-
-  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
-    return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?);";
-  }
-
-  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory;";
-  }
-
-  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date <= date(?);";
-  }
-
-  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date >= date(?);";
-
-  }
-
-  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
-    return "select query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?);";
-
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySetHueDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySetHueDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySetHueDB.java
new file mode 100644
index 0000000..a9e9695
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySetHueDB.java
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public abstract class QuerySetHueDB {
+
+
+  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
+    prSt.setString(1, username);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    prSt.setString(3, endate);
+    return prSt;
+  }
+
+  /**
+   * for all user
+   */
+  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    prSt.setString(2, endate);
+    return prSt;
+  }
+
+  public PreparedStatement getUserName(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchUserNamSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select owner_id, query from beeswax_queryhistory where owner_id =?;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?);";
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?);";
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?);";
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select owner_id, query from beeswax_queryhistory;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select owner_id, query from beeswax_queryhistory where submission_date <= date(?);";
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select owner_id, query from beeswax_queryhistory where submission_date >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select owner_id, query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?);";
+
+  }
+
+  protected String fetchUserNamSql() {
+    return "select username from auth_user where id = ?;";
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java
deleted file mode 100644
index 417df3a..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
-
-
-public class SqliteQuerySet extends QuerySet {
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySetHueDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySetHueDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySetHueDB.java
new file mode 100644
index 0000000..febdb95
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySetHueDB.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.historyqueryset;
+
+
+public class SqliteQuerySetHueDB extends QuerySetHueDB {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java
deleted file mode 100644
index d91633d..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
-
-
-public class MysqlQuerySet extends QuerySet {
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySetHueDb.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySetHueDb.java
new file mode 100644
index 0000000..fad3c50
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySetHueDb.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+
+public class MysqlQuerySetHueDb extends QuerySetHueDb {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java
deleted file mode 100644
index 3190885..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
-
-
-public class OracleQuerySet extends QuerySet {
-
-  @Override
-  protected String fetchuserIdfromUsernameSql() {
-    return "select id from auth_user where username=?";
-
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?)";
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?)";
-
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?) AND mtime <= date(?)";
-
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'";
-  }
-  @Override
-  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?)";
-
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?)";
-
-  }
-  @Override
-  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?) AND mtime <= date(?)";
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySetHueDb.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySetHueDb.java
new file mode 100644
index 0000000..f1e1ede
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySetHueDb.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+
+public class OracleQuerySetHueDb extends QuerySetHueDb {
+
+  @Override
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?) AND mtime <= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?) AND mtime <= date(?)";
+
+  }
+  @Override
+  protected String fetchUserNameSql() {
+    return "select username from auth_user";
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java
deleted file mode 100644
index 83d32c7..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
-
-
-public class PostgressQuerySet extends QuerySet {
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySetHueDb.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySetHueDb.java
new file mode 100644
index 0000000..a466cbc
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySetHueDb.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+
+public class PostgressQuerySetHueDb extends QuerySetHueDb {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
deleted file mode 100644
index c81d51a..0000000
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-
-public  abstract class QuerySet {
-
-
-  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
-    prSt.setString(1, username);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
-    prSt.setInt(1, id);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, enddate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, startdate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
-    prSt.setInt(1, id);
-    prSt.setString(2, startdate);
-    prSt.setString(3, endate);
-    return prSt;
-  }
-
-  /**
-   * for all user
-   */
-  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
-    prSt.setString(1, enddate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
-    prSt.setString(1, startdate);
-    return prSt;
-  }
-
-  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
-    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
-    prSt.setString(1, startdate);
-    prSt.setString(2, endate);
-    return prSt;
-  }
-
-
-  protected String fetchuserIdfromUsernameSql() {
-    return "select id from auth_user where username=?;";
-
-  }
-
-  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?;";
-  }
-
-  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?);";
-  }
-
-  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?);";
-
-  }
-
-  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?) AND mtime <= date(?);";
-
-  }
-
-  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query';";
-  }
-
-  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?);";
-
-  }
-
-  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?);";
-
-  }
-
-  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
-    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?) AND mtime <= date(?);";
-
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySetHueDb.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySetHueDb.java
new file mode 100644
index 0000000..0f1a5f1
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySetHueDb.java
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public  abstract class QuerySetHueDb {
+
+
+  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
+    prSt.setString(1, username);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    prSt.setString(3, endate);
+    return prSt;
+  }
+
+  /**
+   * for all user
+   */
+  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    prSt.setString(2, endate);
+    return prSt;
+  }
+
+  public PreparedStatement getUserName(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchUserNameSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?);";
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?) AND mtime <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query';";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?) AND mtime <= date(?);";
+
+  }
+
+  protected String fetchUserNameSql() {
+    return "select username from auth_user where id = ?;";
+  }
+
+
+}