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-20299. The Migrated Query Status UNKNOWN is to be replaced by original status as per hue query execution(Ishan Bhatt via gauravn7)
Date Fri, 03 Mar 2017 15:22:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d51150d02 -> 4d92ae8c5


AMBARI-20299. The Migrated Query Status UNKNOWN is to be replaced by original status as per
hue query execution(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/4d92ae8c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4d92ae8c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4d92ae8c

Branch: refs/heads/trunk
Commit: 4d92ae8c5e6b9a0876fa9fe2c7210d65f9fee264
Parents: d51150d
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Fri Mar 3 20:51:30 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Fri Mar 3 20:52:11 2017 +0530

----------------------------------------------------------------------
 .../historyqueryset/MysqlQuerySetAmbariDB.java  |  4 +--
 .../historyqueryset/OracleQuerySetAmbariDB.java |  4 +--
 .../hive/historyqueryset/QuerySetAmbariDB.java  | 14 +++++----
 .../historyqueryset/OracleQuerySetHueDB.java    | 16 +++++-----
 .../hive/historyqueryset/QuerySetHueDB.java     | 16 +++++-----
 .../HiveHistoryMigrationUtility.java            |  2 +-
 ...HiveHistoryQueryMigrationImplementation.java | 10 +++---
 .../resources/scripts/models/HiveModel.java     | 33 ++++++++++++++++++++
 8 files changed, 68 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/MysqlQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/MysqlQuerySetAmbariDB.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/MysqlQuerySetAmbariDB.java
index 4c6bffa..d99d799 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/MysqlQuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/MysqlQuerySetAmbariDB.java
@@ -34,11 +34,11 @@ public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB {
   }
   @Override
   protected String getSqlInsertHiveHistoryForHive(int id) {
-    return "INSERT INTO DS_JOBIMPL_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet');";
+    return "INSERT INTO DS_JOBIMPL_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','',?,?,'','Worksheet');";
   }
   @Override
   protected String getSqlInsertHiveHistoryForHiveNext(int id) {
-    return "INSERT INTO DS_JOBIMPL_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet');";
+    return "INSERT INTO DS_JOBIMPL_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','',?,?,'','Worksheet');";
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java
index eaf8c10..05435aa 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java
@@ -40,11 +40,11 @@ public class OracleQuerySetAmbariDB extends QuerySetAmbariDB {
 
   @Override
   protected String getSqlInsertHiveHistoryForHive(int id) {
-    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet')";
+    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','',?,?,'','Worksheet')";
   }
   @Override
   protected String getSqlInsertHiveHistoryForHiveNext(int id) {
-    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet')";
+    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','',?,?,'','Worksheet')";
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java
index dbf4f26..cfec553 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java
@@ -54,7 +54,7 @@ public abstract class QuerySetAmbariDB {
     return prSt;
   }
 
-  public PreparedStatement insertToHiveHistoryForHive(Connection connection, int id, String
maxcount, long epochtime, String dirname,String username) throws SQLException {
+  public PreparedStatement insertToHiveHistoryForHive(Connection connection, int id, String
maxcount, long epochtime, String dirname,String username, String jobStatus) throws SQLException
{
 
     String Logfile=  dirname + "logs";
     String queryHqlFile= dirname + "query.hql";
@@ -66,12 +66,13 @@ public abstract class QuerySetAmbariDB {
     prSt.setString(3, Logfile);
     prSt.setString(4, username);
     prSt.setString(5, queryHqlFile);
-    prSt.setString(6, dirname);
+    prSt.setString(6, jobStatus);
+    prSt.setString(7, dirname);
 
     return prSt;
   }
 
-  public PreparedStatement insertToHiveHistoryForHiveNext(Connection connection, int id,
String maxcount, long epochtime, String dirname,String username) throws SQLException {
+  public PreparedStatement insertToHiveHistoryForHiveNext(Connection connection, int id,
String maxcount, long epochtime, String dirname,String username, String jobStatus) throws
SQLException {
 
     String Logfile=  dirname + "logs";
     String queryHqlFile= dirname + "query.hql";
@@ -83,7 +84,8 @@ public abstract class QuerySetAmbariDB {
     prSt.setString(3, Logfile);
     prSt.setString(4, username);
     prSt.setString(5, queryHqlFile);
-    prSt.setString(6, dirname);
+    prSt.setString(6, jobStatus);
+    prSt.setString(7, dirname);
 
     return prSt;
   }
@@ -110,11 +112,11 @@ public abstract class QuerySetAmbariDB {
   }
 
   protected String getSqlInsertHiveHistoryForHive(int id) {
-    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet');";
+    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','',?,?,?,'','job','','',?,?,'','Worksheet');";
   }
 
   protected String getSqlInsertHiveHistoryForHiveNext(int id) {
-    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','','UNKNOWN',?,'','Worksheet');";
+    return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','','','',?,?,?,'','job','','',?,?,'','Worksheet');";
   }
 
   protected String getRevSql(int id,String maxcount){

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/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
index b504a68..79d5eaa 100644
--- 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
@@ -26,36 +26,36 @@ public class OracleQuerySetHueDB extends QuerySetHueDB {
   }
   @Override
   protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select owner_id, query from beeswax_queryhistory where owner_id =?";
+    return "select last_state, owner_id, query from beeswax_queryhistory where owner_id =?";
   }
   @Override
   protected String fetchHueQueriesNoStartdateYesEnddateSql() {
-    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date
<= to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where owner_id =?
AND submission_date <= to_date(?, 'YYYY-MM-DD')";
   }
   @Override
   protected String fetchHueQueriesYesStartdateNoEnddateSql() {
-    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date
>= to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where owner_id =?
AND submission_date >= to_date(?, 'YYYY-MM-DD')";
   }
   @Override
   protected String fetchHueQueriesYesStartdateYesEnddateSql() {
-    return "select owner_id, query from beeswax_queryhistory where owner_id =? AND submission_date
>= to_date(?, 'YYYY-MM-DD') AND submission_date <= to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where owner_id =?
AND submission_date >= to_date(?, 'YYYY-MM-DD') AND submission_date <= to_date(?, 'YYYY-MM-DD')";
   }
   @Override
   protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
-    return "select owner_id, query from beeswax_queryhistory";
+    return "select last_state, owner_id, query from beeswax_queryhistory";
   }
   @Override
   protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select owner_id, query from beeswax_queryhistory where submission_date <=
to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where submission_date
<= to_date(?, 'YYYY-MM-DD')";
   }
   @Override
   protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
-    return "select owner_id, query from beeswax_queryhistory where submission_date >=
to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where submission_date
>= to_date(?, 'YYYY-MM-DD')";
 
   }
   @Override
   protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
-    return "select owner_id, query from beeswax_queryhistory where submission_date >=
to_date(?, 'YYYY-MM-DD') AND submission_date <= to_date(?, 'YYYY-MM-DD')";
+    return "select last_state, owner_id, query from beeswax_queryhistory where submission_date
>= to_date(?, 'YYYY-MM-DD') AND submission_date <= to_date(?, 'YYYY-MM-DD')";
 
   }
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/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
index a9e9695..04e493e 100644
--- 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
@@ -98,36 +98,36 @@ public abstract class QuerySetHueDB {
   }
 
   protected String fetchHueQueriesNoStartdateNoEnddateSql() {
-    return "select owner_id, query from beeswax_queryhistory where owner_id =?;";
+    return "select last_state, 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(?);";
+    return "select last_state, 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(?);";
+    return "select last_state, 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(?);";
+    return "select last_state, 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;";
+    return "select last_state, owner_id, query from beeswax_queryhistory;";
   }
 
   protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
-    return "select owner_id, query from beeswax_queryhistory where submission_date <=
date(?);";
+    return "select last_state, 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(?);";
+    return "select last_state, 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(?);";
+    return "select last_state, owner_id, query from beeswax_queryhistory where submission_date
>= date(?) AND submission_date <= date(?);";
 
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
index 7c3b2c2..90885ae 100755
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
@@ -193,7 +193,7 @@ public class HiveHistoryMigrationUtility {
 
             String versionName = hiveHistoryQueryImpl.getAllHiveVersionInstance(connectionAmbaridb,
ambaridatabase, instance);
 
-            hiveHistoryQueryImpl.insertRowinAmbaridb(dirNameforHiveHistroy, maxCountOfAmbariDb,
epochTime, connectionAmbaridb, id, instance, i, ambaridatabase, versionName, username);//
inserting in ambari database
+            hiveHistoryQueryImpl.insertRowinAmbaridb(dirNameforHiveHistroy, maxCountOfAmbariDb,
epochTime, connectionAmbaridb, id, instance, i, ambaridatabase, versionName, username, dbpojoHiveHistoryQuery.get(i).getJobStatus());//
inserting in ambari database
 
             if (view.getProperties().get("KerberoseEnabled").equals("y")) {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
index 1a5b742..11e57d9 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
@@ -132,16 +132,16 @@ public class HiveHistoryQueryMigrationImplementation {
   }
 
 
-  public void insertRowinAmbaridb(String dirname, int maxcount, long epochtime, Connection
c, int id, String instance, int i, QuerySetAmbariDB ambaridatabase, String versionName, String
username) throws SQLException, IOException {
+  public void insertRowinAmbaridb(String dirname, int maxcount, long epochtime, Connection
c, int id, String instance, int i, QuerySetAmbariDB ambaridatabase, String versionName, String
username, String jobStatus) throws SQLException, IOException {
 
     String maxcount1 = Integer.toString(maxcount);
     String epochtime1 = Long.toString(epochtime);
     PreparedStatement prSt = null;
     String revsql = null;
     if (versionName.contains("1.0")) {
-      prSt = ambaridatabase.insertToHiveHistoryForHive(c, id, maxcount1, epochtime, dirname,
username);
+      prSt = ambaridatabase.insertToHiveHistoryForHive(c, id, maxcount1, epochtime, dirname,
username, jobStatus);
     } else {
-      prSt = ambaridatabase.insertToHiveHistoryForHiveNext(c, id, maxcount1, epochtime, dirname,
username);
+      prSt = ambaridatabase.insertToHiveHistoryForHiveNext(c, id, maxcount1, epochtime, dirname,
username, jobStatus);
     }
 
     logger.info("The actual insert statement is " + prSt);
@@ -272,7 +272,7 @@ public class HiveHistoryQueryMigrationImplementation {
       Statement statement = connection.createStatement();
       String query, ownerName = "";
       ResultSet rs;
-      int ownerId;
+      int ownerId, jobState;
 
       ResultSet rs1 = null;
       if (username.equals("all")) {
@@ -324,6 +324,7 @@ public class HiveHistoryQueryMigrationImplementation {
 
       while (rs1.next()) {
         HiveModel hivepojo = new HiveModel();
+        jobState = rs1.getInt("last_state");
         ownerId = rs1.getInt("owner_id");
         if(username.equals("all")) {
           prSt = huedatabase.getUserName(connection, ownerId);
@@ -333,6 +334,7 @@ public class HiveHistoryQueryMigrationImplementation {
           }
         }
         query = rs1.getString("query");
+        hivepojo.setJobStatus(jobState);
         hivepojo.setOwnerName(ownerName);
         hivepojo.setQuery(query);
         hiveArrayList.add(hivepojo);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d92ae8c/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java
b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java
index d467fb0..1edec84 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java
@@ -22,6 +22,13 @@ import java.util.ArrayList;
 
 public class HiveModel {
 
+  //Hive Job Statutes                                                 Hue Corresponding Status
+  private static final String JOB_STATE_INITIALIZED = "INITIALIZED";   //submitted
+  private static final String JOB_STATE_RUNNING = "RUNNING";           //running
+  private static final String JOB_STATE_FINISHED = "SUCCEEDED";        //available
+  private static final String JOB_STATE_ERROR = "ERROR";               //failed
+  private static final String JOB_STATE_UNKNOWN = "UNKNOWN";           //expired
+
   private String database;
   private String query;
   private String queryTitle;
@@ -29,6 +36,7 @@ public class HiveModel {
   private ArrayList<String> udfClasses;
   private ArrayList<String> udfNames;
   private String ownerName;
+  private String jobStatus;
 
 
   public String getDatabase() {
@@ -78,4 +86,29 @@ public class HiveModel {
   public String getOwnerName() { return ownerName; }
 
   public void setOwnerName(String ownerName) { this.ownerName = ownerName; }
+
+  public String getJobStatus() { return jobStatus; }
+
+  public void setJobStatus(int state) {
+    switch (state) {
+      case 0:
+        jobStatus = JOB_STATE_INITIALIZED;
+        break;
+      case 1:
+        jobStatus = JOB_STATE_RUNNING;
+        break;
+      case 2:
+        jobStatus = JOB_STATE_FINISHED;
+        break;
+      case 3:
+        jobStatus = JOB_STATE_ERROR;
+        break;
+      case 4:
+        jobStatus = JOB_STATE_UNKNOWN;
+        break;
+      default:
+        return;
+    }
+
+  }
 }


Mime
View raw message