You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ni...@apache.org on 2017/04/04 07:33:42 UTC

[01/11] ambari git commit: AMBARI-20598 : added support for stats of partitioned table for hive server version 2.1 and above (nitirajrathore)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 c8e937afe -> 4dbae3d55


AMBARI-20598 : added support for stats of partitioned table for hive server version 2.1 and above (nitirajrathore)


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

Branch: refs/heads/branch-2.5
Commit: 4dbae3d55b8e1459c64eb700d2d6f2f016401e1e
Parents: 934a5bc
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue Mar 28 16:50:47 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../ambari/view/hive20/ConnectionDelegate.java  |  4 ++
 .../view/hive20/HiveJdbcConnectionDelegate.java |  6 ++
 .../ambari/view/hive20/actor/JdbcConnector.java | 38 +++++++++-
 .../view/hive20/actor/StatementExecutor.java    | 15 ++++
 .../actor/message/GetDatabaseMetadataJob.java   | 24 +++++++
 .../hive20/actor/message/ResultInformation.java | 19 +++++
 .../view/hive20/actor/message/job/Result.java   | 19 ++++-
 .../ambari/view/hive20/client/DDLDelegator.java |  3 +
 .../view/hive20/client/DDLDelegatorImpl.java    | 53 ++++++++++----
 .../hive20/client/DatabaseMetadataWrapper.java  | 37 ++++++++++
 .../view/hive20/internal/dto/ColumnStats.java   |  5 ++
 .../view/hive20/internal/dto/TableStats.java    | 12 ++++
 .../parsers/DatabaseMetadataExtractor.java      | 46 ++++++++++++
 .../internal/parsers/TableMetaParser.java       |  3 +-
 .../internal/parsers/TableMetaParserImpl.java   |  9 ++-
 .../view/hive20/resources/browser/DDLProxy.java | 23 ++++--
 .../ui/app/components/table-statistics.js       | 73 ++++++++++++++++----
 .../resources/ui/app/services/stats-service.js  | 15 +---
 .../templates/components/table-statistics.hbs   | 25 ++++++-
 19 files changed, 372 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/ConnectionDelegate.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/ConnectionDelegate.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/ConnectionDelegate.java
index f3c4e91..6f03480 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/ConnectionDelegate.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/ConnectionDelegate.java
@@ -23,6 +23,7 @@ import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob;
 import org.apache.hive.jdbc.HiveConnection;
 import org.apache.hive.jdbc.HiveStatement;
 
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
@@ -31,6 +32,9 @@ public interface ConnectionDelegate {
   Optional<ResultSet> execute(String statement) throws SQLException;
   Optional<ResultSet> execute(HiveConnection connection, String statement) throws SQLException;
   ResultSet getColumnMetadata(HiveConnection connection, GetColumnMetadataJob job) throws SQLException;
+
+  DatabaseMetaData getDatabaseMetadata(HiveConnection connection) throws SQLException;
+
   void cancel() throws SQLException;
   void closeResultSet();
   void closeStatement();

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveJdbcConnectionDelegate.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveJdbcConnectionDelegate.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveJdbcConnectionDelegate.java
index 5cc60fb..12149e8 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveJdbcConnectionDelegate.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HiveJdbcConnectionDelegate.java
@@ -73,6 +73,12 @@ public class HiveJdbcConnectionDelegate implements ConnectionDelegate {
   }
 
   @Override
+  public DatabaseMetaData getDatabaseMetadata(HiveConnection connection) throws SQLException {
+    DatabaseMetaData metaData = connection.getMetaData();
+    return metaData;
+  }
+
+  @Override
   public void cancel() throws SQLException {
     if (currentStatement != null) {
       currentStatement.cancel();

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
index 4b218b1..f93ecbf 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
@@ -30,6 +30,7 @@ import org.apache.ambari.view.hive20.actor.message.Connect;
 import org.apache.ambari.view.hive20.actor.message.FetchError;
 import org.apache.ambari.view.hive20.actor.message.FetchResult;
 import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob;
+import org.apache.ambari.view.hive20.actor.message.GetDatabaseMetadataJob;
 import org.apache.ambari.view.hive20.actor.message.HiveJob;
 import org.apache.ambari.view.hive20.actor.message.HiveMessage;
 import org.apache.ambari.view.hive20.actor.message.ResultInformation;
@@ -51,8 +52,11 @@ import org.apache.ambari.view.hive20.actor.message.lifecycle.FreeConnector;
 import org.apache.ambari.view.hive20.actor.message.lifecycle.InactivityCheck;
 import org.apache.ambari.view.hive20.actor.message.lifecycle.KeepAlive;
 import org.apache.ambari.view.hive20.actor.message.lifecycle.TerminateInactivityCheck;
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
+import org.apache.ambari.view.hive20.exceptions.ServiceException;
 import org.apache.ambari.view.hive20.internal.Connectable;
 import org.apache.ambari.view.hive20.internal.ConnectionException;
+import org.apache.ambari.view.hive20.internal.parsers.DatabaseMetadataExtractor;
 import org.apache.ambari.view.hive20.persistence.Storage;
 import org.apache.ambari.view.hive20.persistence.utils.ItemNotFound;
 import org.apache.ambari.view.hive20.resources.jobs.viewJobs.Job;
@@ -64,6 +68,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.duration.Duration;
 
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayDeque;
@@ -78,7 +83,7 @@ import java.util.concurrent.TimeUnit;
  */
 public class JdbcConnector extends HiveActor {
 
-  private final Logger LOG = LoggerFactory.getLogger(getClass());
+  private static final Logger LOG = LoggerFactory.getLogger(JdbcConnector.class);
 
   public static final String SUFFIX = "validating the login";
 
@@ -190,6 +195,8 @@ public class JdbcConnector extends HiveActor {
       runStatementJob((SQLStatementJob) message);
     } else if (message instanceof GetColumnMetadataJob) {
       runGetMetaData((GetColumnMetadataJob) message);
+    } else if (message instanceof GetDatabaseMetadataJob) {
+      runGetDatabaseMetaData((GetDatabaseMetadataJob) message);
     } else if (message instanceof ExecuteNextStatement) {
       executeNextStatement();
     } else if (message instanceof ResultInformation) {
@@ -252,6 +259,12 @@ public class JdbcConnector extends HiveActor {
       processFailure(failure);
       return;
     }
+    Optional<DatabaseMetaData> databaseMetaDataOptional = message.getDatabaseMetaData();
+    if (databaseMetaDataOptional.isPresent()) {
+      DatabaseMetaData databaseMetaData = databaseMetaDataOptional.get();
+      processDatabaseMetadata(databaseMetaData);
+      return;
+    }
     if (statementQueue.size() == 0) {
       // This is the last resultSet
       processResult(message.getResultSet());
@@ -286,6 +299,19 @@ public class JdbcConnector extends HiveActor {
     }
   }
 
+  private void processDatabaseMetadata(DatabaseMetaData databaseMetaData) {
+    executing = false;
+    isFailure = false;
+    // Send for sync execution
+    try {
+      DatabaseMetadataWrapper databaseMetadataWrapper = new DatabaseMetadataExtractor(databaseMetaData).extract();
+      commandSender.tell(databaseMetadataWrapper, self());
+    } catch (ServiceException e) {
+      commandSender.tell(new ExecutionFailed(e.getMessage(), e), self());
+    }
+    cleanUpWithTermination();
+  }
+
   private void stopStatementExecutor() {
     if (statementExecutor != null) {
       statementExecutor.tell(PoisonPill.getInstance(), ActorRef.noSender());
@@ -387,6 +413,16 @@ public class JdbcConnector extends HiveActor {
     statementExecutor.tell(message, self());
   }
 
+  private void runGetDatabaseMetaData(GetDatabaseMetadataJob message) {
+    if (!checkConnection()) return;
+    resetToInitialState();
+    executing = true;
+    executionType = message.getType();
+    commandSender = getSender();
+    statementExecutor = getStatementExecutor();
+    statementExecutor.tell(message, self());
+  }
+
   private ActorRef getStatementExecutor() {
     return getContext().actorOf(Props.create(StatementExecutor.class, hdfsApi, storage, connectable.getConnection().get(), connectionDelegate)
       .withDispatcher("akka.actor.result-dispatcher"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java
index c3ed14b..d73a284 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java
@@ -23,6 +23,7 @@ import akka.actor.Props;
 import com.google.common.base.Optional;
 import org.apache.ambari.view.hive20.ConnectionDelegate;
 import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob;
+import org.apache.ambari.view.hive20.actor.message.GetDatabaseMetadataJob;
 import org.apache.ambari.view.hive20.actor.message.HiveMessage;
 import org.apache.ambari.view.hive20.actor.message.ResultInformation;
 import org.apache.ambari.view.hive20.actor.message.RunStatement;
@@ -36,6 +37,7 @@ import org.apache.hive.jdbc.HiveStatement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.UUID;
@@ -70,6 +72,8 @@ public class StatementExecutor extends HiveActor {
       runStatement((RunStatement) message);
     } else if (message instanceof GetColumnMetadataJob) {
       getColumnMetaData((GetColumnMetadataJob) message);
+    }else if (message instanceof GetDatabaseMetadataJob) {
+      getDatabaseMetaData((GetDatabaseMetadataJob) message);
     }
   }
 
@@ -151,4 +155,15 @@ public class StatementExecutor extends HiveActor {
           ", tablePattern: " + message.getTablePattern() + ", ColumnPattern: " + message.getColumnPattern(), e)), self());
     }
   }
+
+  private void getDatabaseMetaData(GetDatabaseMetadataJob message) {
+    try {
+      DatabaseMetaData metaData = connectionDelegate.getDatabaseMetadata(connection);
+      sender().tell(new ResultInformation(-1, metaData), self());
+    } catch (SQLException e) {
+      LOG.error("Failed to get database metadata.", e);
+      sender().tell(new ResultInformation(-1,
+        new Failure("Failed to get database metadata.", e)), self());
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetDatabaseMetadataJob.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetDatabaseMetadataJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetDatabaseMetadataJob.java
new file mode 100644
index 0000000..b7fe37f
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetDatabaseMetadataJob.java
@@ -0,0 +1,24 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.hive20.actor.message;
+
+public class GetDatabaseMetadataJob extends HiveJob {
+  public GetDatabaseMetadataJob(String username) {
+    super(Type.SYNC, username);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java
index 5b5e17c..0f86010 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java
@@ -21,6 +21,7 @@ package org.apache.ambari.view.hive20.actor.message;
 import com.google.common.base.Optional;
 import org.apache.ambari.view.hive20.actor.message.job.Failure;
 
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 
 /**
@@ -41,6 +42,7 @@ public class ResultInformation {
   private final Failure failure;
 
   private final boolean cancelled;
+  private DatabaseMetaData databaseMetaData;
 
   private ResultInformation(int id, ResultSet resultSet, Failure failure, boolean cancelled) {
     this.id = id;
@@ -57,6 +59,11 @@ public class ResultInformation {
     this(id, null, null, false);
   }
 
+  public ResultInformation(int id, ResultSet resultSet, DatabaseMetaData metaData, Failure failure, boolean cancelled ) {
+    this(id, null, null, false);
+    this.databaseMetaData = metaData;
+  }
+
   public ResultInformation(int id, Failure failure) {
     this(id, null, failure, false);
   }
@@ -65,6 +72,10 @@ public class ResultInformation {
     this(id, null, null, cancelled);
   }
 
+  public ResultInformation(int id, DatabaseMetaData metaData) {
+    this(id, null, metaData, null, false);
+  }
+
   public int getId() {
     return id;
   }
@@ -80,4 +91,12 @@ public class ResultInformation {
   public boolean isCancelled() {
     return cancelled;
   }
+
+  public Optional<DatabaseMetaData> getDatabaseMetaData() {
+    return Optional.fromNullable(databaseMetaData);
+  }
+
+  public void setDatabaseMetaData(DatabaseMetaData databaseMetaData) {
+    this.databaseMetaData = databaseMetaData;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java
index f8c3ba0..2d8fc4d 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java
@@ -20,19 +20,34 @@ package org.apache.ambari.view.hive20.actor.message.job;
 
 import com.google.common.collect.ImmutableList;
 import org.apache.ambari.view.hive20.client.ColumnDescription;
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
 import org.apache.ambari.view.hive20.client.Row;
 
+import java.sql.DatabaseMetaData;
 import java.util.List;
 
 public class Result {
-  private final List<ColumnDescription> columns;
-  private final List<Row> rows;
+  private List<ColumnDescription> columns;
+  private List<Row> rows;
+  private DatabaseMetadataWrapper databaseMetadata;
 
   public Result(List<Row> rows, List<ColumnDescription> columns) {
     this.rows = ImmutableList.copyOf(rows);
     this.columns = columns;
   }
 
+  public Result(DatabaseMetadataWrapper databaseMetadata){
+    this.databaseMetadata = databaseMetadata;
+  }
+
+  public DatabaseMetadataWrapper getDatabaseMetadata() {
+    return databaseMetadata;
+  }
+
+  public void setDatabaseMetadata(DatabaseMetadataWrapper databaseMetadata) {
+    this.databaseMetadata = databaseMetadata;
+  }
+
   public List<Row> getRows() {
     return rows;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegator.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegator.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegator.java
index baa82b4..2f5331e 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegator.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegator.java
@@ -20,6 +20,7 @@ package org.apache.ambari.view.hive20.client;
 
 import java.util.List;
 
+import org.apache.ambari.view.hive20.exceptions.ServiceException;
 import org.apache.ambari.view.hive20.internal.dto.DatabaseInfo;
 import org.apache.ambari.view.hive20.internal.dto.TableInfo;
 
@@ -40,4 +41,6 @@ public interface DDLDelegator {
   Cursor<Row, ColumnDescription> getTableListCursor(ConnectionConfig config, String database, String like);
 
   Cursor<Row, ColumnDescription> getTableDescriptionCursor(ConnectionConfig config, String database, String table, String like, boolean extended);
+
+  DatabaseMetadataWrapper getDatabaseMetadata(ConnectionConfig config) throws ServiceException;
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
index d6756ef..c20c847 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
@@ -18,15 +18,20 @@
 
 package org.apache.ambari.view.hive20.client;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
-
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.Inbox;
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Optional;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.hive20.actor.message.Connect;
 import org.apache.ambari.view.hive20.actor.message.ExecuteJob;
 import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob;
+import org.apache.ambari.view.hive20.actor.message.GetDatabaseMetadataJob;
 import org.apache.ambari.view.hive20.actor.message.HiveJob;
 import org.apache.ambari.view.hive20.actor.message.SQLStatementJob;
 import org.apache.ambari.view.hive20.actor.message.job.AuthenticationFailed;
@@ -37,24 +42,20 @@ import org.apache.ambari.view.hive20.actor.message.job.NoMoreItems;
 import org.apache.ambari.view.hive20.actor.message.job.NoResult;
 import org.apache.ambari.view.hive20.actor.message.job.Result;
 import org.apache.ambari.view.hive20.actor.message.job.ResultSetHolder;
+import org.apache.ambari.view.hive20.exceptions.ServiceException;
 import org.apache.ambari.view.hive20.internal.dto.DatabaseInfo;
 import org.apache.ambari.view.hive20.internal.dto.TableInfo;
 import org.apache.ambari.view.hive20.utils.HiveActorConfiguration;
 import org.apache.ambari.view.hive20.utils.ServiceFormattedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.actor.Inbox;
 import scala.concurrent.duration.Duration;
 
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
 public class DDLDelegatorImpl implements DDLDelegator {
 
   public static final String NO_VALUE_MARKER = "NO_VALUE";
@@ -207,6 +208,23 @@ public class DDLDelegatorImpl implements DDLDelegator {
     return getResultFromDB(execute);
   }
 
+  @Override
+  public DatabaseMetadataWrapper getDatabaseMetadata(ConnectionConfig config) throws ServiceException {
+    Connect connect = config.createConnectMessage();
+    HiveJob job = new GetDatabaseMetadataJob(config.getUsername());
+    ExecuteJob execute = new ExecuteJob(connect, job);
+
+    LOG.info("Fetching databaseMetadata.");
+    Optional<Result> resultOptional = getResultFromDB(execute);
+    if(resultOptional.isPresent()){
+      Result result = resultOptional.get();
+      DatabaseMetadataWrapper databaseMetadata = result.getDatabaseMetadata();
+      return databaseMetadata;
+    }else{
+      throw new ServiceException("Cannot fetch database version.");
+    }
+  }
+
   private Optional<Result> getResultFromDB(ExecuteJob job) {
     List<ColumnDescription> descriptions = null;
     List<Row> rows = Lists.newArrayList();
@@ -226,6 +244,11 @@ public class DDLDelegatorImpl implements DDLDelegator {
       return Optional.absent();
     }
 
+    if (submitResult instanceof DatabaseMetadataWrapper) {
+      LOG.info("Query returned with no result.");
+      return Optional.of(new Result((DatabaseMetadataWrapper)submitResult));
+    }
+
     if (submitResult instanceof ExecutionFailed) {
       ExecutionFailed error = (ExecutionFailed) submitResult;
       LOG.error("Failed to get the table description");

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DatabaseMetadataWrapper.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DatabaseMetadataWrapper.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DatabaseMetadataWrapper.java
new file mode 100644
index 0000000..5ea9fed
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DatabaseMetadataWrapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.hive20.client;
+
+public class DatabaseMetadataWrapper {
+  private final int databaseMajorVersion;
+  private final int databaseMinorVersion;
+
+  public DatabaseMetadataWrapper(int databaseMajorVersion, int databaseMinorVersion) {
+    this.databaseMajorVersion = databaseMajorVersion;
+    this.databaseMinorVersion = databaseMinorVersion;
+  }
+
+  @Override
+  public String toString() {
+    return "DatabaseMetadataWrapper{" +
+        "databaseMajorVersion=" + databaseMajorVersion +
+        ", databaseMinorVersion=" + databaseMinorVersion +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnStats.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnStats.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnStats.java
index 190ecd3..1654a1f 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnStats.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnStats.java
@@ -44,6 +44,7 @@ public class ColumnStats {
   private String numTrues;
   private String numFalse;
   private String comment;
+  private String columnStatsAccurate;
 
   public String getDatabaseName() {
     return databaseName;
@@ -167,4 +168,8 @@ public class ColumnStats {
     sb.append('}');
     return sb.toString();
   }
+
+  public void setColumnStatsAccurate(String columnStatsAccurate) {
+    this.columnStatsAccurate = columnStatsAccurate;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableStats.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableStats.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableStats.java
index 3048d22..5d0f307 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableStats.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableStats.java
@@ -18,6 +18,9 @@
 
 package org.apache.ambari.view.hive20.internal.dto;
 
+
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
+
 /**
  * this will be returned as a part of TableMeta which table info is called.
  * It includes the part of DetailedTableInfo which contain statistics related data.
@@ -29,6 +32,7 @@ public class TableStats {
   public static final String RAW_DATA_SIZE = "rawDataSize";
   public static final String TOTAL_SIZE = "totalSize";
 
+  private DatabaseMetadataWrapper databaseMetadata;
   private Boolean isTableStatsEnabled;
   private Integer numFiles;
   private Integer numRows;
@@ -96,4 +100,12 @@ public class TableStats {
     sb.append('}');
     return sb.toString();
   }
+
+  public DatabaseMetadataWrapper getDatabaseMetadata() {
+    return databaseMetadata;
+  }
+
+  public void setDatabaseMetadata(DatabaseMetadataWrapper databaseMetadata) {
+    this.databaseMetadata = databaseMetadata;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/DatabaseMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/DatabaseMetadataExtractor.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/DatabaseMetadataExtractor.java
new file mode 100644
index 0000000..1ae146a
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/DatabaseMetadataExtractor.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.hive20.internal.parsers;
+
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
+import org.apache.ambari.view.hive20.exceptions.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+public class DatabaseMetadataExtractor {
+  private static final Logger LOG = LoggerFactory.getLogger(DatabaseMetadataExtractor.class);
+
+  private final DatabaseMetaData databaseMetaData;
+
+  public DatabaseMetadataExtractor(DatabaseMetaData databaseMetaData) {
+    this.databaseMetaData = databaseMetaData;
+  }
+
+  public DatabaseMetadataWrapper extract() throws ServiceException {
+    try {
+      return new DatabaseMetadataWrapper(databaseMetaData.getDatabaseMajorVersion(), databaseMetaData.getDatabaseMinorVersion());
+    } catch (SQLException e) {
+      LOG.error("Error occurred while fetching version from database metadata.", e);
+      throw new ServiceException(e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParser.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParser.java
index aae23c8..251aace 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParser.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParser.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.view.hive20.internal.parsers;
 
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
 import org.apache.ambari.view.hive20.client.Row;
 
 import java.util.List;
@@ -26,5 +27,5 @@ import java.util.List;
  *
  */
 public interface TableMetaParser<T> {
-  T parse(String database, String table, List<Row> createTableStatementRows, List<Row> describeFormattedRows);
+  T parse(String database, String table, List<Row> createTableStatementRows, List<Row> describeFormattedRows, DatabaseMetadataWrapper databaseMetadata);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParserImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParserImpl.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParserImpl.java
index f2a1933..711cab9 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParserImpl.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/TableMetaParserImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.view.hive20.internal.parsers;
 
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
 import org.apache.ambari.view.hive20.client.Row;
 import org.apache.ambari.view.hive20.internal.dto.ColumnInfo;
 import org.apache.ambari.view.hive20.internal.dto.DetailedTableInfo;
@@ -55,10 +56,11 @@ public class TableMetaParserImpl implements TableMetaParser<TableMeta> {
   private ViewInfoParser viewInfoParser;
 
   @Override
-  public TableMeta parse(String database, String table, List<Row> createTableStatementRows, List<Row> describeFormattedRows) {
+  public TableMeta parse(String database, String table, List<Row> createTableStatementRows, List<Row> describeFormattedRows, DatabaseMetadataWrapper databaseMetadata) {
     String createTableStatement = createTableStatementParser.parse(createTableStatementRows);
     DetailedTableInfo tableInfo = detailedTableInfoParser.parse(describeFormattedRows);
     TableStats tableStats = getTableStats(tableInfo);
+    tableStats.setDatabaseMetadata(databaseMetadata);
     StorageInfo storageInfo = storageInfoParser.parse(describeFormattedRows);
     List<ColumnInfo> columns = columnInfoParser.parse(describeFormattedRows);
     PartitionInfo partitionInfo = partitionInfoParser.parse(describeFormattedRows);
@@ -118,7 +120,10 @@ public class TableMetaParserImpl implements TableMetaParser<TableMeta> {
       tableStats.setTotalSize(Integer.valueOf(totalSize.trim()));
     }
 
-    tableStats.setColumnStatsAccurate(columnStatsAccurate);
+    if(!Strings.isNullOrEmpty(columnStatsAccurate) && !Strings.isNullOrEmpty(columnStatsAccurate.trim())) {
+      tableStats.setTableStatsEnabled(true);
+      tableStats.setColumnStatsAccurate(columnStatsAccurate);
+    }
     return tableStats;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
index 0c93ba3..77857f9 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
@@ -29,6 +29,7 @@ import org.apache.ambari.view.hive20.ConnectionSystem;
 import org.apache.ambari.view.hive20.client.ConnectionConfig;
 import org.apache.ambari.view.hive20.client.DDLDelegator;
 import org.apache.ambari.view.hive20.client.DDLDelegatorImpl;
+import org.apache.ambari.view.hive20.client.DatabaseMetadataWrapper;
 import org.apache.ambari.view.hive20.client.HiveClientException;
 import org.apache.ambari.view.hive20.client.Row;
 import org.apache.ambari.view.hive20.exceptions.ServiceException;
@@ -146,8 +147,14 @@ public class DDLProxy {
     DDLDelegator delegator = new DDLDelegatorImpl(context, ConnectionSystem.getInstance().getActorSystem(), ConnectionSystem.getInstance().getOperationController(context));
     List<Row> createTableStatementRows = delegator.getTableCreateStatement(connectionConfig, databaseName, tableName);
     List<Row> describeFormattedRows = delegator.getTableDescriptionFormatted(connectionConfig, databaseName, tableName);
+    DatabaseMetadataWrapper databaseMetadata = new DatabaseMetadataWrapper(1, 0);
+    try {
+      databaseMetadata = delegator.getDatabaseMetadata(connectionConfig);
+    } catch (ServiceException e) {
+      LOG.error("Exception while fetching hive version", e);
+    }
 
-    return tableMetaParser.parse(databaseName, tableName, createTableStatementRows, describeFormattedRows);
+    return tableMetaParser.parse(databaseName, tableName, createTableStatementRows, describeFormattedRows, databaseMetadata);
   }
 
   private Optional<DatabaseInfo> selectDatabase(final String databaseId) {
@@ -353,6 +360,7 @@ public class DDLProxy {
        List<String[]> rows = results.getRows();
        Map<Integer, String> headerMap = new HashMap<>();
        boolean header = true;
+        ColumnStats columnStats = new ColumnStats();
         for(String[] row : rows){
           if(header){
             for(int i = 0 ; i < row.length; i++){
@@ -364,10 +372,14 @@ public class DDLProxy {
           }
           else if(row.length > 0 ){
             if(columnName.equals(row[0])){ // the first column of the row contains column name
-              return createColumnStats(row, headerMap);
+              createColumnStats(row, headerMap, columnStats);
+            }else if( row.length > 1 && row[0].equalsIgnoreCase("COLUMN_STATS_ACCURATE")){
+              columnStats.setColumnStatsAccurate(row[1]);
             }
           }
         }
+
+        return columnStats;
       }else{
         throw new ServiceException("Cannot find any result for this jobId: " + jobId);
       }
@@ -375,9 +387,6 @@ public class DDLProxy {
       LOG.error("Exception occurred while fetching results for column statistics with jobId: {}", jobId, e);
       throw new ServiceException(e);
     }
-
-    LOG.error("Column stats not found in the fetched results.");
-    throw new ServiceException("Could not find the column stats in the result.");
   }
 
   /**
@@ -386,13 +395,13 @@ public class DDLProxy {
    * indexes : 0           1        2    3     4             5               6             7           8         9    10
    * @param row
    * @param headerMap
+   * @param columnStats
    * @return
    */
-  private ColumnStats createColumnStats(String[] row, Map<Integer, String> headerMap) throws ServiceException {
+  private ColumnStats createColumnStats(String[] row, Map<Integer, String> headerMap, ColumnStats columnStats) throws ServiceException {
     if(null == row){
       throw new ServiceException("row cannot be null.");
     }
-    ColumnStats columnStats = new ColumnStats();
     for(int i = 0 ; i < row.length; i++){
       switch(headerMap.get(i)){
         case ColumnStats.COLUMN_NAME:

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/resources/ui/app/components/table-statistics.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/table-statistics.js b/contrib/views/hive20/src/main/resources/ui/app/components/table-statistics.js
index 0310cbc..c6846d3 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/components/table-statistics.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/table-statistics.js
@@ -20,13 +20,52 @@ import Ember from 'ember';
 import UILoggerMixin from '../mixins/ui-logger';
 
 export default Ember.Component.extend(UILoggerMixin, {
+  columnStatsKeys : [
+    {dataKey: 'min', label: 'MIN'},
+    {dataKey: 'max', label: 'MAX'},
+    {dataKey: 'numNulls', label: 'NUMBER OF NULLS'},
+    {dataKey: 'distinctCount', label: 'DISTINCT COUNT'},
+    {dataKey: 'avgColLen', label: 'AVERAGE COLUMN LENGTH'},
+    {dataKey: 'maxColLen', label: 'MAX COLUMN LENGTH'},
+    {dataKey: 'numTrues', label: 'NUMBER OF TRUE'},
+    {dataKey: 'numFalse', label: 'NUMBER OF FALSE'},
+  ],
+
   statsService: Ember.inject.service(),
 
   analyseWithStatistics: false,
+  partitionStatSupportedVersion: "2.1",
+  isTablePartitioned: Ember.computed("table.partitionInfo.columns", function(){
+    return this.get("table.partitionInfo.columns") && this.get("table.partitionInfo.columns.length") > 0;
+  }),
+  partitionStatSupported: Ember.computed("table.tableStats.databaseMetadata.databaseMajorVersion",
+    "table.tableStats.databaseMetadata.databaseMinorVersion", function(){
+    if(this.get('table.tableStats.databaseMetadata.databaseMajorVersion') > 2){
+      return true;
+    }else if(this.get('table.tableStats.databaseMetadata.databaseMajorVersion') === 2
+      && this.get('table.tableStats.databaseMetadata.databaseMinorVersion') >= 1){
+      return true;
+    }
 
+    return false;
+  }),
+  showStats:Ember.computed("partitionStatSupported", "isTablePartitioned", function(){
+    if(!this.get("isTablePartitioned")) {
+      return true;
+    }else{
+      if(this.get("partitionStatSupported")){
+        return true;
+      }else{
+        return false;
+      }
+    }
+  }),
   tableStats: Ember.computed.oneWay('table.tableStats'),
+
   tableStatisticsEnabled: Ember.computed.oneWay('table.tableStats.isTableStatsEnabled'),
 
+  basicStatsAccurate: Ember.computed.oneWay('columnStatsAccurate.BASIC_STATS'),
+
   columnStatsAccurate: Ember.computed('table.tableStats.columnStatsAccurate', function () {
     let columnStatsJson = this.get('table.tableStats.columnStatsAccurate');
     return Ember.isEmpty(columnStatsJson) ? {} : JSON.parse(columnStatsJson.replace(/\\\"/g, '"'));
@@ -37,12 +76,14 @@ export default Ember.Component.extend(UILoggerMixin, {
     return !stats ? [] : Object.keys(stats);
   }),
 
-  columns: Ember.computed('table.columns', 'columnsWithStatistics', function () {
+  columns: Ember.computed('table.columns', function () {
     let cols = this.get('table.columns');
-    let colsWithStatistics = this.get('columnsWithStatistics');
+    if(this.get("table.partitionInfo.columns")){ // show stats for all columns
+      cols = cols.concat(this.get("table.partitionInfo.columns"));
+    }
     return cols.map((col) => {
       let copy = Ember.Object.create(col);
-      copy.set('hasStatistics', colsWithStatistics.contains(copy.name));
+      copy.set('hasStatistics', true);
       copy.set('isFetchingStats', false);
       copy.set('statsError', false);
       copy.set('showStats', true);
@@ -50,14 +91,6 @@ export default Ember.Component.extend(UILoggerMixin, {
     });
   }),
 
-  allColumnsHasStatistics: Ember.computed('table.columns', 'columnsWithStatistics', function () {
-    let colsNames = this.get('table.columns').getEach('name');
-    let colsWithStatistics = this.get('columnsWithStatistics');
-
-    let colsNotIn = colsNames.filter((item) => !colsWithStatistics.contains(item));
-    return colsNotIn.length === 0;
-  }),
-
   performTableAnalysis(withColumns = false) {
     const tableName = this.get('table.table');
     const databaseName = this.get('table.database');
@@ -94,7 +127,23 @@ export default Ember.Component.extend(UILoggerMixin, {
       return this.get('statsService').fetchColumnStatsResult(databaseName, tableName, column.name, job);
     }).then((data) => {
       column.set('isFetchingStats', false);
-      column.set('stats', data);
+      let colStatAccurate = data["columnStatsAccurate"];
+      let colStatAccurateJson = Ember.isEmpty(colStatAccurate) ? {} : JSON.parse(colStatAccurate.replace(/\\\"/g, '"'));
+      if(this.get("partitionStatSupported")){
+        if(!colStatAccurateJson["COLUMN_STATS"] || colStatAccurateJson["COLUMN_STATS"][column.name] === "false"){
+          column.set('statsWarn', true);
+          column.set('statsWarnMsg', "Column statistics might be stale. Please  consider recomputing with 'include columns' option checked.");
+        }
+      }else if( !this.get("partitionStatSupported") && !(this.get("columnsWithStatistics").contains(column.get("name")))){
+        column.set('statsWarn', true);
+        column.set('statsWarnMsg', "Column statistics might be stale. Please  consider recomputing with 'include columns' option checked.");
+      }
+
+      let statsData = this.get("columnStatsKeys").map((item) => {
+        return {label: item.label, value: data[item.dataKey]};
+      });
+
+      column.set('stats', statsData);
     }).catch((err) => {
       column.set('isFetchingStats', false);
       column.set('statsError', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/resources/ui/app/services/stats-service.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/stats-service.js b/contrib/views/hive20/src/main/resources/ui/app/services/stats-service.js
index 620bf9b..9d46acd 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/services/stats-service.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/stats-service.js
@@ -18,17 +18,6 @@
 
 import Ember from 'ember';
 
-const columnStatsKeys = [
-  {dataKey: 'min', label: 'MIN'},
-  {dataKey: 'max', label: 'MAX'},
-  {dataKey: 'numNulls', label: 'NUMBER OF NULLS'},
-  {dataKey: 'distinctCount', label: 'DISTINCT COUNT'},
-  {dataKey: 'avgColLen', label: 'AVERAGE COLUMN LENGTH'},
-  {dataKey: 'maxColLen', label: 'MAX COLUMN LENGTH'},
-  {dataKey: 'numTrues', label: 'NUMBER OF TRUE'},
-  {dataKey: 'numFalse', label: 'NUMBER OF FALSE'},
-  ];
-
 export default Ember.Service.extend({
   jobs: Ember.inject.service(),
   store: Ember.inject.service(),
@@ -68,9 +57,7 @@ export default Ember.Service.extend({
   fetchColumnStatsResult(databaseName, tableName, columnName, job) {
     return this.get('store').adapterFor('table').fetchColumnStats(databaseName, tableName, columnName, job.get('id')).then((data) => {
       let columnStats = data.columnStats;
-      return columnStatsKeys.map((item) => {
-        return {label: item.label, value: columnStats[item.dataKey]};
-      });
+      return columnStats;
     });
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4dbae3d5/contrib/views/hive20/src/main/resources/ui/app/templates/components/table-statistics.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/table-statistics.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/table-statistics.hbs
index 5f62fca..cdcf762 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/table-statistics.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/table-statistics.hbs
@@ -16,6 +16,7 @@
 * limitations under the License.
 }}
 
+{{#if showStats}}
 <div class="row">
   <div class="alert">
     <p class="lead">
@@ -36,6 +37,12 @@
 </div>
 <div class="row">
   {{#if tableStatisticsEnabled}}
+    {{#if (not basicStatsAccurate) }}
+      <div class="alert alert-warning">
+        <p> Table statistics might be stale. Please consider recomputing statistics.
+        </p>
+      </div>
+    {{/if}}
     <div class="stats-section">
       <p><strong>TABLE STATISTICS</strong></p>
       <table class="table table-bordered table-hover">
@@ -108,6 +115,12 @@
             {{/if}}
 
             {{#if (and column.stats column.showStats)}}
+              {{#if column.statsWarn}}
+                <div class="alert alert-warning">
+                  <p> {{column.statsWarnMsg}}
+                  </p>
+                </div>
+              {{/if}}
               <div class="col-stats-details">
                 <table class="table table-bordered table-hover ">
                   <thead>
@@ -126,10 +139,8 @@
                   </tbody>
                 </table>
               </div>
+              {{/if}}
             {{/if}}
-          {{else}}
-            No statistics computed
-          {{/if}}
         </td>
       </tr>
     {{/each}}
@@ -155,3 +166,11 @@
     </div>
   {{/modal-dialog}}
 {{/if}}
+{{else}}
+  <div class="alert alert-danger">
+    <p>  Statistics not supported for partitioned table in Hive Server version lesser than {{partitionStatSupportedVersion}}.
+         Your current Hive Server version is {{table.tableStats.databaseMetadata.databaseMajorVersion}}.{{table.tableStats.databaseMetadata.databaseMinorVersion}}
+    </p>
+  </div>
+{{/if}}
+


[03/11] ambari git commit: AMBARI-20574. Hive View 2.0 On SLES12-Table created on Upload throws error. (gauravn7)

Posted by ni...@apache.org.
AMBARI-20574. Hive View 2.0 On SLES12-Table created on Upload throws error. (gauravn7)


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

Branch: refs/heads/branch-2.5
Commit: bdd927eec11185c6a435ac7f5c2a50dc4c8ac581
Parents: a3d4a1e
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Sun Mar 26 22:05:18 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../ui/app/routes/databases/database/tables/upload-table.js        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd927ee/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
index bfd603b..5fee140 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
@@ -295,7 +295,7 @@ export default NewTable.extend(UILoggerMixin, {
       tableMeta.settings.rowFormat = {};
     }
     tableMeta.settings.rowFormat.fieldTerminatedBy = this.getCharOptionByCharCode(1);
-    tableMeta.settings.rowFormat.escapeDefinedAs = this.getCharOptionByCharCode(0);
+    tableMeta.settings.rowFormat.escapeDefinedAs = this.getCharOptionByCharCode(2);
     return this.createTable(tableMeta);
   },
 


[08/11] ambari git commit: AMBARI-20573. Hive view 2.0 fails on LLAP (Gaurav Nagar via nitirajrathore)

Posted by ni...@apache.org.
AMBARI-20573. Hive view 2.0 fails on LLAP (Gaurav Nagar via nitirajrathore)


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

Branch: refs/heads/branch-2.5
Commit: a3d4a1e11df93443b6e819f681d86d610511ac0b
Parents: 62f99b6
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue Apr 4 12:43:23 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../apache/ambari/server/view/ViewRegistry.java | 51 ++++++++++++++++++--
 1 file changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4a1e1/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index 058a2c2..24eceb2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -84,6 +84,7 @@ import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.orm.entities.ViewEntityEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceDataEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
+import org.apache.ambari.server.orm.entities.ViewInstancePropertyEntity;
 import org.apache.ambari.server.orm.entities.ViewParameterEntity;
 import org.apache.ambari.server.orm.entities.ViewResourceEntity;
 import org.apache.ambari.server.orm.entities.ViewURLEntity;
@@ -92,6 +93,8 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.utils.VersionUtils;
@@ -985,7 +988,7 @@ public class ViewRegistry {
 
         try {
           if (checkAutoInstanceConfig(autoConfig, stackId, event.getServiceName(), serviceNames)) {
-            installAutoInstance(clusterId, clusterName, viewEntity, viewName, viewConfig, autoConfig, roles);
+            installAutoInstance(clusterId, clusterName, cluster.getService(event.getServiceName()), viewEntity, viewName, viewConfig, autoConfig, roles);
           }
         } catch (Exception e) {
           LOG.error("Can't auto create instance of view " + viewName + " for cluster " + clusterName +
@@ -997,9 +1000,10 @@ public class ViewRegistry {
     }
   }
 
-  private void installAutoInstance(Long clusterId, String clusterName, ViewEntity viewEntity, String viewName, ViewConfig viewConfig, AutoInstanceConfig autoConfig, Collection<String> roles) throws SystemException, ValidationException {
+  private void installAutoInstance(Long clusterId, String clusterName, Service service, ViewEntity viewEntity, String viewName, ViewConfig viewConfig, AutoInstanceConfig autoConfig, Collection<String> roles) throws SystemException, ValidationException {
     LOG.info("Auto creating instance of view " + viewName + " for cluster " + clusterName + ".");
     ViewInstanceEntity viewInstanceEntity = createViewInstanceEntity(viewEntity, viewConfig, autoConfig);
+    updateHiveLLAPSettingsIfRequired(viewInstanceEntity, service);
     viewInstanceEntity.setClusterHandle(clusterId);
     installViewInstance(viewInstanceEntity);
     setViewInstanceRoleAccess(viewInstanceEntity, roles);
@@ -1014,6 +1018,47 @@ public class ViewRegistry {
 
   }
 
+  /**
+   * Checks is service is 'HIVE' and INTERACTIVE_SERVICE(LLAP) is enabled. Then, it sets the view instance
+   * parameter 'use.hive.interactive.mode' for the 'AUTO_INSTANCE_VIEW' to be true.
+   * @param viewInstanceEntity
+   * @param service
+   */
+  private void updateHiveLLAPSettingsIfRequired(ViewInstanceEntity viewInstanceEntity, Service service) {
+    String INTERACTIVE_KEY = "use.hive.interactive.mode";
+    String LLAP_COMPONENT_NAME = "HIVE_SERVER_INTERACTIVE";
+    String viewVersion = viewInstanceEntity.getViewDefinition().getVersion();
+    String viewName = viewInstanceEntity.getViewDefinition().getViewName();
+    if(!viewName.equalsIgnoreCase("HIVE") || viewVersion.equalsIgnoreCase("1.0.0")) {
+      return;
+    }
+
+    try {
+      ServiceComponent component = service.getServiceComponent(LLAP_COMPONENT_NAME);
+      if (component.getServiceComponentHosts().size() == 0) {
+        // The LLAP server is not installed in any of the hosts. Hence, return;
+        return;
+      }
+
+      for (Map.Entry<String, String> property : viewInstanceEntity.getPropertyMap().entrySet()) {
+        if (INTERACTIVE_KEY.equals(property.getKey()) && (!"true".equalsIgnoreCase(property.getValue()))) {
+          ViewInstancePropertyEntity propertyEntity = new ViewInstancePropertyEntity();
+          propertyEntity.setViewInstanceName(viewInstanceEntity.getName());
+          propertyEntity.setViewName(viewInstanceEntity.getViewName());
+          propertyEntity.setName(INTERACTIVE_KEY);
+          propertyEntity.setValue("true");
+          propertyEntity.setViewInstanceEntity(viewInstanceEntity);
+          viewInstanceEntity.getProperties().add(propertyEntity);
+        }
+      }
+
+    } catch (AmbariException e) {
+      LOG.error("Failed to update '{}' parameter for viewName: {}, version: {}. Exception: {}",
+          INTERACTIVE_KEY, viewName, viewVersion, e);
+    }
+
+  }
+
   private String getUrlName(ViewInstanceEntity viewInstanceEntity) {
     return viewInstanceEntity.getViewEntity().getCommonName().toLowerCase() + "_" + viewInstanceEntity.getInstanceName().toLowerCase();
   }
@@ -1931,7 +1976,7 @@ public class ViewRegistry {
         try {
 
           if (checkAutoInstanceConfig(autoInstanceConfig, stackId, service, serviceNames)) {
-            installAutoInstance(clusterId, clusterName, viewEntity, viewName, viewConfig, autoInstanceConfig, roles);
+            installAutoInstance(clusterId, clusterName, cluster.getService(service), viewEntity, viewName, viewConfig, autoInstanceConfig, roles);
           }
         } catch (Exception e) {
           LOG.error("Can't auto create instance of view " + viewName + " for cluster " + clusterName +


[09/11] ambari git commit: AMBARI-20576. Issue in pig view after enabling strict mode (Venkata Sairam via pallavkul)

Posted by ni...@apache.org.
AMBARI-20576. Issue in pig view after enabling strict mode (Venkata Sairam via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: ff0e3a4270ee9aa6998331833e2f92ca682f3b58
Parents: 5fe2d46
Author: pallavkul <pa...@gmail.com>
Authored: Mon Mar 27 12:24:41 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../views/pig/src/main/resources/ui/pig-web/app/routes/splash.js   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ff0e3a42/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
index 66e1c88..5cfeac7 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
@@ -54,7 +54,7 @@ App.SplashRoute = Em.Route.extend({
         controller.startTests(model).then(function () {
           if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest") && model.get("userhomeTest")) {
             Ember.run.later(this, function () {
-              previousTransition = App.get('previousTransition');
+              let previousTransition = App.get('previousTransition');
               if (previousTransition) {
                 previousTransition.retry();
               } else {


[04/11] ambari git commit: AMBARI-20529. Make home directory check as optional in wfmanager view (Madhan Mohan Reddy via pallavkul)

Posted by ni...@apache.org.
AMBARI-20529. Make home directory check as optional in wfmanager view (Madhan Mohan Reddy via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: 52bc319d368cb337078161e7b2fdc4961c253415
Parents: c8e937a
Author: pallavkul <pa...@gmail.com>
Authored: Fri Mar 24 14:05:06 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../apache/oozie/ambari/view/HDFSFileUtils.java | 41 +++++++++++-
 .../ambari/view/OozieProxyImpersonator.java     | 16 +++--
 .../main/resources/ui/app/controllers/index.js  |  5 +-
 .../src/main/resources/ui/app/routes/index.js   | 66 ++++++++++++++++----
 4 files changed, 107 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/52bc319d/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/HDFSFileUtils.java
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/HDFSFileUtils.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/HDFSFileUtils.java
index d06eb07..09c63e3 100644
--- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/HDFSFileUtils.java
+++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/HDFSFileUtils.java
@@ -21,8 +21,11 @@ import com.google.common.base.Optional;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.commons.hdfs.UserService;
 import org.apache.ambari.view.commons.hdfs.ViewPropertyHelper;
+import org.apache.ambari.view.utils.hdfs.ConfigurationBuilder;
 import org.apache.ambari.view.utils.hdfs.HdfsApi;
+import org.apache.ambari.view.utils.hdfs.HdfsApiException;
 import org.apache.ambari.view.utils.hdfs.HdfsUtil;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileStatus;
@@ -31,12 +34,18 @@ import org.slf4j.LoggerFactory;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Arrays;
+import java.util.List;
+import java.util.LinkedList;
 
 public class HDFSFileUtils {
 	public static final String VIEW_CONF_KEYVALUES = "view.conf.keyvalues";
-
+	private static final String DEFAULT_FS = "fs.defaultFS";
+	private static final String AMBARI_SKIP_HOME_DIRECTORY_CHECK_PROTOCOL_LIST = "views.skip.home-directory-check.file-system.list";
 	private final static Logger LOGGER = LoggerFactory
 			.getLogger(HDFSFileUtils.class);
 	private ViewContext viewContext;
@@ -108,6 +117,36 @@ public class HDFSFileUtils {
 		}
 	}
 
+	public Boolean shouldCheckForHomeDir(){
+		Optional<Map<String, String>> viewConfigs = ViewPropertyHelper.getViewConfigs(viewContext, VIEW_CONF_KEYVALUES);
+		ConfigurationBuilder configBuilder;
+		if(viewConfigs.isPresent()) {
+			configBuilder = new ConfigurationBuilder(this.viewContext, viewConfigs.get());
+		}else{
+			configBuilder = new ConfigurationBuilder(this.viewContext);
+		}
+		Configuration configurations = null;
+		try {
+			configurations = configBuilder.buildConfig();
+		} catch (HdfsApiException e) {
+			throw	 new RuntimeException(e);
+		}
+		String defaultFS = configurations.get(DEFAULT_FS);
+		try {
+			URI fsUri = new URI(defaultFS);
+			String protocol = fsUri.getScheme();
+			String ambariSkipCheckValues = viewContext.getAmbariProperty(AMBARI_SKIP_HOME_DIRECTORY_CHECK_PROTOCOL_LIST);
+			List<String> protocolSkipList = (ambariSkipCheckValues == null? new LinkedList<String>() : Arrays.asList(ambariSkipCheckValues.split(",")));
+			if(null != protocol && protocolSkipList.contains(protocol)){
+				return Boolean.FALSE;
+			}
+		} catch (URISyntaxException e) {
+			LOGGER.error("Error occurred while parsing the defaultFS URI.", e);
+			return Boolean.TRUE;
+		}
+		return Boolean.TRUE;
+	}
+
 	public FileStatus getFileStatus(String filePath) {
 		try {
 			return getHdfsgetApi().getFileStatus(filePath);

http://git-wip-us.apache.org/repos/asf/ambari/blob/52bc319d/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java
index d82f928..8d2b5a5 100644
--- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java
+++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java
@@ -160,11 +160,17 @@ public class OozieProxyImpersonator {
   @GET
   @Path("/getWorkflowManagerConfigs")
   public Response getWorkflowConfigs() {
-    HashMap<String, String> workflowConfigs = new HashMap<String, String>();
-    workflowConfigs.put("nameNode", viewContext.getProperties().get("webhdfs.url"));
-    workflowConfigs.put("resourceManager", viewContext.getProperties().get("yarn.resourcemanager.address"));
-    workflowConfigs.put("userName", viewContext.getUsername());
-    return Response.ok(workflowConfigs).build();
+    try {
+      HashMap<String, String> workflowConfigs = new HashMap<String, String>();
+      workflowConfigs.put("nameNode", viewContext.getProperties().get("webhdfs.url"));
+      workflowConfigs.put("resourceManager", viewContext.getProperties().get("yarn.resourcemanager.address"));
+      workflowConfigs.put("userName", viewContext.getUsername());
+      workflowConfigs.put("checkHomeDir",hdfsFileUtils.shouldCheckForHomeDir().toString());
+      return Response.ok(workflowConfigs).build();
+    } catch (Exception e) {
+      LOGGER.error(e.getMessage(), e);
+      throw new WfmWebException(e);
+    }
   }
 
   @POST

http://git-wip-us.apache.org/repos/asf/ambari/blob/52bc319d/contrib/views/wfmanager/src/main/resources/ui/app/controllers/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/index.js b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/index.js
index f4d93ea..25fdb6d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/index.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/index.js
@@ -23,14 +23,13 @@ export default Ember.Controller.extend({
   issues : Ember.A([]),
   serviceChecks : Ember.A([
     {'name':'oozie', 'checkCompleted':false, isAvailable : true, 'displayName' : 'Oozie Test', 'errorMessage' : 'Oozie service check failed'},
-    {'name':'hdfs', 'checkCompleted':false, isAvailable : true, 'displayName' : 'HDFS Test', 'errorMessage' : 'HDFS service check failed'},
-    {'name':'homeDir', 'checkCompleted':false, isAvailable : true, 'displayName' : 'User Home Directory Test', 'errorMessage' : 'User home directory not found'}
+    {'name':'hdfs', 'checkCompleted':false, isAvailable : true, 'displayName' : 'HDFS Test', 'errorMessage' : 'HDFS service check failed'}
   ]),
   width : Ember.computed('serviceChecks.@each.checkCompleted','serviceChecks.@each.isAvailable', function(){
     let width = 10;
     this.get('serviceChecks').forEach((check)=>{
       if(check.checkCompleted && check.isAvailable){
-        width += 30;
+        width += (90/this.get('serviceChecks').length);
       }
     });
     return Ember.String.htmlSafe(`${width}%`);

http://git-wip-us.apache.org/repos/asf/ambari/blob/52bc319d/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
index 316ec0e..6d94dfe 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
@@ -19,23 +19,45 @@ import Ember from 'ember';
 
 export default Ember.Route.extend({
     afterModel(){
+      let workflowManagerConfigsPromise = this.getWorkflowManagerConfigs();
+      workflowManagerConfigsPromise.then(function(data){
+        this.invokeServiceChecksPromises(JSON.parse(data));
+      }.bind(this)).catch(function(errors){
+        this.controllerFor('index').set('errors', errors);
+      }.bind(this));
+    },
+    invokeServiceChecksPromises(workflowManagerConfigs) {
       let ooziePromise = this.checkOozie();
       let hdfsPromise = this.checkHdfs();
-      let homeDirPromise = this.checkUserHome();
-      let serviceChecks = this.controllerFor('index').get('serviceChecks');
       this.controllerFor('index').get('issues').clear();
+      let serviceChecks = this.controllerFor('index').get('serviceChecks');
       this.processServiceCheckPromise(ooziePromise, serviceChecks.findBy('name', 'oozie'));
       this.processServiceCheckPromise(hdfsPromise, serviceChecks.findBy('name', 'hdfs'));
-      this.processServiceCheckPromise(homeDirPromise, serviceChecks.findBy('name', 'homeDir'));
-      Ember.RSVP.Promise.all([ooziePromise, hdfsPromise, homeDirPromise]).then(()=>{
-        this.controllerFor('index').set('serviceChecksComplete', true);
-        Ember.run.later(()=>{
-          this.transitionTo('design');
-      }, 2000);
-      }).catch((errors)=>{
-        this.controllerFor('index').set('serviceChecksComplete', true);
-        this.controllerFor('index').set('errors', errors);
-      });
+
+      if (workflowManagerConfigs.checkHomeDir === 'true') {
+        serviceChecks.pushObject({'name':'homeDir', 'checkCompleted':false, isAvailable : true, 'displayName' : 'User Home Directory Test', 'errorMessage' : 'User home directory not found'})
+        let homeDirPromise = this.checkUserHome();
+        this.processServiceCheckPromise(homeDirPromise, serviceChecks.findBy('name', 'homeDir'));
+        Ember.RSVP.Promise.all([ooziePromise, hdfsPromise, homeDirPromise]).then(()=>{
+          this.controllerFor('index').set('serviceChecksComplete', true);
+          Ember.run.later(()=>{
+            this.transitionTo('design');
+        }, 2000);
+        }).catch((errors)=>{
+          this.controllerFor('index').set('serviceChecksComplete', true);
+          this.controllerFor('index').set('errors', errors);
+        });
+      } else {
+        Ember.RSVP.Promise.all([ooziePromise, hdfsPromise]).then(()=>{
+          this.controllerFor('index').set('serviceChecksComplete', true);
+          Ember.run.later(()=>{
+            this.transitionTo('design');
+        }, 2000);
+        }).catch((errors)=>{
+          this.controllerFor('index').set('serviceChecksComplete', true);
+          this.controllerFor('index').set('errors', errors);
+        });
+      }
     },
     processServiceCheckPromise(promise, serviceCheck){
       promise.then(()=>{
@@ -109,6 +131,26 @@ export default Ember.Route.extend({
         });
       });
     },
+    getWorkflowManagerConfigs(){
+      return new Ember.RSVP.Promise((resolve, reject) => {
+        var url = Ember.ENV.API_URL + "/getWorkflowManagerConfigs";
+          Ember.$.ajax({
+          url: url,
+          method: "GET",
+          dataType: "text",
+          contentType: "text/plain;charset=utf-8",
+          beforeSend: function(request) {
+            request.setRequestHeader("X-Requested-By", "workflow-designer");
+          },
+          success : function(response){
+            resolve(response);
+          },
+          error : function(response){
+            reject(response);
+          }
+        });
+      });
+    },
     actions : {
       showDetails (check){
         Ember.set(check, 'showingDetails', !check.showingDetails);


[06/11] ambari git commit: AMBARI-20558. HiveView does not work on WASB ACLs cluster (Gaurav Nagar via nitirajrathore)

Posted by ni...@apache.org.
AMBARI-20558. HiveView does not work on WASB ACLs cluster (Gaurav Nagar via nitirajrathore)


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

Branch: refs/heads/branch-2.5
Commit: 62f99b659e1b1ea0f4b89f1667206c3740d82b0f
Parents: b7cd5f9
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue Apr 4 12:39:08 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/62f99b65/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
----------------------------------------------------------------------
diff --git a/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java b/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
index 66679e8..90fa483 100644
--- a/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
+++ b/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
@@ -66,6 +66,7 @@ public class HdfsApi {
       InterruptedException, HdfsApiException {
     this.authParams = configurationBuilder.buildAuthenticationConfig();
     conf = configurationBuilder.buildConfig();
+    UserGroupInformation.setConfiguration(conf);
     ugi = UserGroupInformation.createProxyUser(username, getProxyUser());
 
     fs = execute(new PrivilegedExceptionAction<FileSystem>() {


[11/11] ambari git commit: AMBARI-20584. Pig view doesn't load in older version of firefox (Venkata Sairam via pallavkul)

Posted by ni...@apache.org.
AMBARI-20584. Pig view doesn't load in older version of firefox (Venkata Sairam via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: 9dd5dcd7f03f29fbf83528a8dbabef1cebf8f811
Parents: ff0e3a4
Author: pallavkul <pa...@gmail.com>
Authored: Mon Mar 27 18:56:16 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/pig-web/app/controllers/splash.js  | 2 +-
 .../pig/src/main/resources/ui/pig-web/app/routes/splash.js   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9dd5dcd7/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
index 4451b84..468fdfa 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
@@ -61,7 +61,7 @@ App.SplashController = Ember.ObjectController.extend({
       model.set('percent', percent + (100/model.get("numberOfChecks")));
     };
 
-    let checks = [];
+    var checks = [];
     if(model.get("serviceCheckPolicy").checkHdfs){
       checks.push("hdfs");
     }else{

http://git-wip-us.apache.org/repos/asf/ambari/blob/9dd5dcd7/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
index 5cfeac7..f9da54d 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
@@ -42,9 +42,9 @@ App.SplashRoute = Em.Route.extend({
     var self = this;
     controller.fetchServiceCheckPolicy()
       .then(function(data){
-        let numberOfChecks = 0;
-        let serviceCheckPolicy = data.serviceCheckPolicy;
-        for (let serviceCheck in serviceCheckPolicy) {
+        var numberOfChecks = 0;
+        var serviceCheckPolicy = data.serviceCheckPolicy;
+        for (var serviceCheck in serviceCheckPolicy) {
           if (serviceCheckPolicy[serviceCheck] === true) {
             numberOfChecks++;
           }
@@ -54,7 +54,7 @@ App.SplashRoute = Em.Route.extend({
         controller.startTests(model).then(function () {
           if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest") && model.get("userhomeTest")) {
             Ember.run.later(this, function () {
-              let previousTransition = App.get('previousTransition');
+              var previousTransition = App.get('previousTransition');
               if (previousTransition) {
                 previousTransition.retry();
               } else {


[07/11] ambari git commit: AMBARI-20572. Issue while loading pig view (Venkata Sairam via pallavkul)

Posted by ni...@apache.org.
AMBARI-20572. Issue while loading pig view (Venkata Sairam via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: 5fe2d4610bd0ef03dec21813a598cebb73c0a268
Parents: bdd927e
Author: pallavkul <pa...@gmail.com>
Authored: Sun Mar 26 08:57:42 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../pig/src/main/resources/ui/pig-web/app/controllers/splash.js    | 1 +
 .../views/pig/src/main/resources/ui/pig-web/app/routes/splash.js   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5fe2d461/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
index b0fa99e..4451b84 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+"use strict";
 
 var App = require('app');
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5fe2d461/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
index 7d34edd..66e1c88 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+"use strict";
 var App = require('app');
 
 App.SplashRoute = Em.Route.extend({


[05/11] ambari git commit: AMBARI-20527. make home directory check as optional in Pig view (Nitiraj Rathore via pallavkul)

Posted by ni...@apache.org.
AMBARI-20527. make home directory check as optional in Pig view (Nitiraj Rathore via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: b7cd5f9d88e2171dd4141e703fac26615773fe03
Parents: 52bc319
Author: pallavkul <pa...@gmail.com>
Authored: Thu Mar 23 19:22:49 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 ambari-server/conf/unix/ambari.properties       |   1 +
 ambari-server/conf/windows/ambari.properties    |   3 +
 .../ambari/view/pig/services/HelpService.java   |  25 +++-
 .../apache/ambari/view/pig/utils/Constants.java |  25 ++++
 .../ambari/view/pig/utils/ServiceCheck.java     | 132 +++++++++++++++++++
 .../ui/pig-web/app/controllers/splash.js        |  39 +++++-
 .../resources/ui/pig-web/app/routes/splash.js   |  42 ++++--
 .../ui/pig-web/app/templates/splash.hbs         |  16 ++-
 8 files changed, 261 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 5866fe7..560edc3 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -69,6 +69,7 @@ views.request.connect.timeout.millis=5000
 views.request.read.timeout.millis=10000
 views.ambari.request.connect.timeout.millis=30000
 views.ambari.request.read.timeout.millis=45000
+views.skip.home-directory-check.file-system.list=wasb,adls,adl
 
 # Scheduler settings
 server.execution.scheduler.isClustered=false

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/ambari-server/conf/windows/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/windows/ambari.properties b/ambari-server/conf/windows/ambari.properties
index c1c0a99..42232b2 100644
--- a/ambari-server/conf/windows/ambari.properties
+++ b/ambari-server/conf/windows/ambari.properties
@@ -106,3 +106,6 @@ views.http.cache-control=no-store
 views.http.pragma=no-cache
 
 mpacks.staging.path=resources\\mpacks
+
+views.skip.home-directory-check.file-system.list=wasb,adls,adl
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java
index a67bfc5..c7e37c5 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java
@@ -21,11 +21,14 @@ package org.apache.ambari.view.pig.services;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.ViewResourceHandler;
 import org.apache.ambari.view.pig.persistence.DataStoreStorage;
-import org.apache.ambari.view.pig.persistence.InstanceKeyValueStorage;
 import org.apache.ambari.view.pig.resources.files.FileService;
 import org.apache.ambari.view.pig.resources.jobs.JobResourceManager;
-import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.ambari.view.pig.utils.ServiceCheck;
+import org.apache.ambari.view.pig.utils.ServiceFormattedException;
+import org.apache.ambari.view.utils.hdfs.HdfsApiException;
 import org.json.simple.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -37,6 +40,9 @@ import java.util.HashMap;
  * Help service
  */
 public class HelpService extends BaseService {
+  private final static Logger LOG =
+    LoggerFactory.getLogger(HelpService.class);
+
   private ViewContext context;
   private ViewResourceHandler handler;
 
@@ -130,6 +136,21 @@ public class HelpService extends BaseService {
     return getOKResponse();
   }
 
+  @GET
+  @Path("/service-check-policy")
+  public Response getServiceCheckList(){
+    ServiceCheck serviceCheck = new ServiceCheck(context);
+    try {
+      ServiceCheck.Policy policy = serviceCheck.getServiceCheckPolicy();
+      JSONObject policyJson = new JSONObject();
+      policyJson.put("serviceCheckPolicy", policy);
+      return Response.ok(policyJson).build();
+    } catch (HdfsApiException e) {
+      LOG.error("Error occurred while generating service check policy : ", e);
+      throw new ServiceFormattedException(e);
+    }
+  }
+
   private Response getOKResponse() {
     JSONObject response = new JSONObject();
     response.put("message", "OK");

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/Constants.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/Constants.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/Constants.java
new file mode 100644
index 0000000..86dacf7
--- /dev/null
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/Constants.java
@@ -0,0 +1,25 @@
+/**
+ * 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.pig.utils;
+
+public interface Constants {
+  String VIEW_CONF_KEYVALUES = "view.conf.keyvalues";
+  String DEFAULT_FS = "fs.defaultFS";
+  String AMBARI_SKIP_HOME_DIRECTORY_CHECK_PROTOCOL_LIST = "views.skip.home-directory-check.file-system.list";
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/ServiceCheck.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/ServiceCheck.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/ServiceCheck.java
new file mode 100644
index 0000000..8f3816a
--- /dev/null
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/utils/ServiceCheck.java
@@ -0,0 +1,132 @@
+/**
+ * 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.pig.utils;
+
+import com.google.common.base.Optional;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.commons.hdfs.ViewPropertyHelper;
+import org.apache.ambari.view.utils.hdfs.ConfigurationBuilder;
+import org.apache.ambari.view.utils.hdfs.HdfsApiException;
+import org.apache.hadoop.conf.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
+public class ServiceCheck {
+  protected static final Logger LOG = LoggerFactory.getLogger(ServiceCheck.class);
+
+  private final ViewContext viewContext;
+
+  public ServiceCheck(ViewContext viewContext){
+    this.viewContext = viewContext;
+  }
+
+  public static class Policy {
+    private boolean checkHdfs = true;
+    private boolean checkHomeDirectory = true;
+    private boolean checkWebhcat = true;
+    private boolean checkStorage = true;
+
+    public Policy() {
+    }
+
+    public Policy(boolean checkHdfs, boolean checkHomeDirectory, boolean checkWebhcat, boolean checkStorage) {
+      this.checkHdfs = checkHdfs;
+      this.checkHomeDirectory = checkHomeDirectory;
+      this.checkWebhcat = checkWebhcat;
+      this.checkStorage = checkStorage;
+    }
+
+    public boolean isCheckHdfs() {
+      return checkHdfs;
+    }
+
+    public void setCheckHdfs(boolean checkHdfs) {
+      this.checkHdfs = checkHdfs;
+    }
+
+    public boolean isCheckHomeDirectory() {
+      return checkHomeDirectory;
+    }
+
+    public void setCheckHomeDirectory(boolean checkHomeDirectory) {
+      this.checkHomeDirectory = checkHomeDirectory;
+    }
+
+    public boolean isCheckWebhcat() {
+      return checkWebhcat;
+    }
+
+    public void setCheckWebhcat(boolean checkWebhcat) {
+      this.checkWebhcat = checkWebhcat;
+    }
+
+    public boolean isCheckStorage() {
+      return checkStorage;
+    }
+
+    public void setCheckStorage(boolean checkStorage) {
+      this.checkStorage = checkStorage;
+    }
+
+    @Override
+    public String toString() {
+      return "Policy{" +
+        "checkHdfs=" + checkHdfs +
+        ", checkHomeDirectory=" + checkHomeDirectory +
+        ", checkWebhcat=" + checkWebhcat +
+        ", checkStorage=" + checkStorage +
+        '}';
+    }
+  }
+
+  public Policy getServiceCheckPolicy() throws HdfsApiException {
+    Policy policy = new Policy();
+    Optional<Map<String, String>> viewConfigs = ViewPropertyHelper.getViewConfigs(viewContext, Constants.VIEW_CONF_KEYVALUES);
+    ConfigurationBuilder configBuilder;
+    if(viewConfigs.isPresent()) {
+      configBuilder = new ConfigurationBuilder(this.viewContext, viewConfigs.get());
+    }else{
+      configBuilder = new ConfigurationBuilder(this.viewContext);
+    }
+
+    Configuration configurations = configBuilder.buildConfig();
+    String defaultFS = configurations.get(Constants.DEFAULT_FS);
+
+    URI fsUri = null;
+    try {
+      fsUri = new URI(defaultFS);
+      String protocol = fsUri.getScheme();
+      String ambariSkipCheckValues = viewContext.getAmbariProperty(Constants.AMBARI_SKIP_HOME_DIRECTORY_CHECK_PROTOCOL_LIST);
+      List<String> protocolSkipList = (ambariSkipCheckValues == null? new LinkedList<String>() : Arrays.asList(ambariSkipCheckValues.split(",")));
+      if(null != protocol && protocolSkipList.contains(protocol)){
+        policy.setCheckHomeDirectory(false);
+        return policy;
+      }
+    } catch (URISyntaxException e) {
+      LOG.error("Error occurred while parsing the defaultFS URI.", e);
+      return policy;
+    }
+
+    return policy;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
index d1b571d..b0fa99e 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
@@ -57,9 +57,38 @@ App.SplashController = Ember.ObjectController.extend({
       }
       model.set(name + 'TestDone', true);
       var percent = model.get('percent');
-      model.set('percent', percent + 25);
+      model.set('percent', percent + (100/model.get("numberOfChecks")));
     };
-    var promises = ['storage', 'webhcat', 'hdfs', 'userhome'].map(function(name) {
+
+    let checks = [];
+    if(model.get("serviceCheckPolicy").checkHdfs){
+      checks.push("hdfs");
+    }else{
+      model.set("hdfs" + 'TestDone', true);
+      model.set("hdfs" + 'Test', true);
+    }
+    if(model.get("serviceCheckPolicy").checkStorage){
+      checks.push("storage");
+    }else{
+      model.set("storage" + 'TestDone', true);
+      model.set("storage" + 'Test', true);
+    }
+
+    if(model.get("serviceCheckPolicy").checkWebhcat){
+      checks.push("webhcat");
+    }else{
+      model.set("webhcat" + 'TestDone', true);
+      model.set("webhcat" + 'Test', true);
+    }
+
+    if(model.get("serviceCheckPolicy").checkHomeDirectory){
+      checks.push("userhome");
+    }else{
+      model.set("userhome" + 'TestDone', true);
+      model.set("userhome" + 'Test', true);
+    }
+
+    var promises = checks.map(function(name) {
       return Ember.$.getJSON('/' + url + name + 'Status')
                .then(
                  function(data) {
@@ -73,6 +102,12 @@ App.SplashController = Ember.ObjectController.extend({
 
     return Ember.RSVP.all(promises);
   },
+  fetchServiceCheckPolicy: function(){
+    var url = App.getNamespaceUrl() + '/resources/pig/help/';
+
+    return Ember.$.getJSON('/' + url + "service-check-policy");
+  },
+
   progressBarStyle: function() {
     return 'width: ' + this.get("model").get("percent") + '%;';
   }.property("model.percent"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
index b30552d..7d34edd 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
@@ -29,26 +29,40 @@ App.SplashRoute = Em.Route.extend({
       hdfsTestDone: null,
       userhomeTest: null,
       userhomeTestDone: null,
-      percent: 0
+      percent: 0,
+      numberOfChecks: null,
+      serviceCheckPolicy: null,
     });
   },
   renderTemplate: function() {
     this.render('splash');
   },
-  setupController: function(controller, model) {
+  setupController: function (controller, model) {
     controller.set('model', model);
     var self = this;
-    controller.startTests(model).then(function() {
-      if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest") && model.get("userhomeTest")) {
-        Ember.run.later(this, function() {
-          previousTransition = App.get('previousTransition');
-          if (previousTransition) {
-            previousTransition.retry();
-          } else {
-            self.transitionTo('pig.scripts');
+    controller.fetchServiceCheckPolicy()
+      .then(function(data){
+        let numberOfChecks = 0;
+        let serviceCheckPolicy = data.serviceCheckPolicy;
+        for (let serviceCheck in serviceCheckPolicy) {
+          if (serviceCheckPolicy[serviceCheck] === true) {
+            numberOfChecks++;
           }
-        }, 2000);
-      }
-    });
-  }
+        }
+        model.set("numberOfChecks", numberOfChecks);
+        model.set("serviceCheckPolicy", serviceCheckPolicy);
+        controller.startTests(model).then(function () {
+          if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest") && model.get("userhomeTest")) {
+            Ember.run.later(this, function () {
+              previousTransition = App.get('previousTransition');
+              if (previousTransition) {
+                previousTransition.retry();
+              } else {
+                self.transitionTo('pig.scripts');
+              }
+            }, 2000);
+          }
+        });
+      });
+  },
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/b7cd5f9d/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs
index c97d724..436ddcf 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs
@@ -35,7 +35,8 @@
 
   <table class="table">
     <tbody>
-      <tr>
+    {{#if model.serviceCheckPolicy.checkStorage}}
+    <tr>
         <td>
           {{#if storageTestDone}}
             {{#if storageTest}}
@@ -49,8 +50,10 @@
         </td>
         <td>{{t 'splash.storage_test'}}</td>
       </tr>
+    {{/if}}
 
-      <tr>
+    {{#if model.serviceCheckPolicy.checkHdfs}}
+    <tr>
         <td>
           {{#if hdfsTestDone}}
             {{#if hdfsTest}}
@@ -64,8 +67,10 @@
         </td>
         <td>{{t 'splash.hdfs_test'}}</td>
       </tr>
+    {{/if}}
 
-      <tr>
+    {{#if model.serviceCheckPolicy.checkWebhcat}}
+    <tr>
         <td>
           {{#if webhcatTestDone}}
             {{#if webhcatTest}}
@@ -79,8 +84,10 @@
         </td>
         <td>{{t 'splash.webhcat_test'}}</td>
       </tr>
+    {{/if}}
 
-      <tr>
+    {{#if model.serviceCheckPolicy.checkHomeDirectory}}
+    <tr>
         <td>
           {{#if userhomeTestDone}}
             {{#if userhomeTest}}
@@ -94,6 +101,7 @@
         </td>
         <td>{{t 'splash.userhome_test'}}</td>
       </tr>
+    {{/if}}
 
     </tbody>
   </table>


[02/11] ambari git commit: AMBARI-20585. Hive view(1.5) doesn't load in older version of firefox (Venkata Sairam via pallavkul)

Posted by ni...@apache.org.
AMBARI-20585. Hive view(1.5) doesn't load in older version of firefox (Venkata Sairam via pallavkul)


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

Branch: refs/heads/branch-2.5
Commit: d2c5ab66343c6f38b1c86f4133c0c4688fd4d39b
Parents: 9dd5dcd
Author: pallavkul <pa...@gmail.com>
Authored: Mon Mar 27 18:58:04 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/hive-web/app/controllers/splash.js | 2 +-
 .../src/main/resources/ui/hive-web/app/routes/splash.js      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d2c5ab66/contrib/views/hive-next/src/main/resources/ui/hive-web/app/controllers/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/resources/ui/hive-web/app/controllers/splash.js b/contrib/views/hive-next/src/main/resources/ui/hive-web/app/controllers/splash.js
index 423a0e3..47b5272 100644
--- a/contrib/views/hive-next/src/main/resources/ui/hive-web/app/controllers/splash.js
+++ b/contrib/views/hive-next/src/main/resources/ui/hive-web/app/controllers/splash.js
@@ -106,7 +106,7 @@ checkConnection: function() {
     };
 
 
-    let checks = [];
+    var checks = [];
     if(model.get("serviceCheckPolicy").checkHdfs){
       checks.push("hdfs");
     }else{

http://git-wip-us.apache.org/repos/asf/ambari/blob/d2c5ab66/contrib/views/hive-next/src/main/resources/ui/hive-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/resources/ui/hive-web/app/routes/splash.js b/contrib/views/hive-next/src/main/resources/ui/hive-web/app/routes/splash.js
index 7e35340..087bab3 100644
--- a/contrib/views/hive-next/src/main/resources/ui/hive-web/app/routes/splash.js
+++ b/contrib/views/hive-next/src/main/resources/ui/hive-web/app/routes/splash.js
@@ -99,9 +99,9 @@ export default Ember.Route.extend({
 
     this.fetchServiceCheckPolicy()
       .then((data) => {
-        let numberOfChecks = 0;
-        let serviceCheckPolicy = data.serviceCheckPolicy;
-        for (let serviceCheck in serviceCheckPolicy) {
+        var numberOfChecks = 0;
+        var serviceCheckPolicy = data.serviceCheckPolicy;
+        for (var serviceCheck in serviceCheckPolicy) {
           if (serviceCheckPolicy[serviceCheck] === true) {
             numberOfChecks++;
           }
@@ -121,7 +121,7 @@ export default Ember.Route.extend({
   },
 
   fetchServiceCheckPolicy: function(){
-    let adapter = this.container.lookup('adapter:service-check');
+    var adapter = this.container.lookup('adapter:service-check');
     return adapter.fetchServiceCheckPolicy();
   },
   actions: {


[10/11] ambari git commit: AMBARI-20587. Hive2: Enable LDAP support for Hive2.0. (dipayanb)

Posted by ni...@apache.org.
AMBARI-20587. Hive2: Enable LDAP support for Hive2.0. (dipayanb)


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

Branch: refs/heads/branch-2.5
Commit: 934a5bcc7fd571c20493e4ba052ae571019b1305
Parents: d2c5ab6
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Tue Mar 28 11:30:36 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 13:03:12 2017 +0530

----------------------------------------------------------------------
 .../ambari/view/hive20/actor/JdbcConnector.java | 29 ++++++++----
 .../actor/message/job/AuthenticationFailed.java | 27 +++++++++++
 .../view/hive20/actor/message/job/Failure.java  |  2 +-
 .../view/hive20/client/DDLDelegatorImpl.java    |  5 ++
 .../resources/browser/ConnectionService.java    | 21 +++++++--
 .../view/hive20/resources/jobs/JobService.java  |  2 +-
 .../resources/ui/app/adapters/application.js    | 12 ++++-
 .../src/main/resources/ui/app/adapters/auth.js  | 27 +++++++++++
 .../ui/app/components/top-application-bar.js    |  3 +-
 .../resources/ui/app/controllers/application.js |  5 +-
 .../resources/ui/app/controllers/password.js    | 44 ++++++++++++++++++
 .../ui/app/controllers/service-check.js         |  8 ++++
 .../hive20/src/main/resources/ui/app/router.js  |  1 +
 .../main/resources/ui/app/routes/application.js | 17 +++++++
 .../main/resources/ui/app/routes/password.js    | 41 +++++++++++++++++
 .../resources/ui/app/routes/service-check.js    |  1 +
 .../main/resources/ui/app/services/ldap-auth.js | 35 ++++++++++++++
 .../resources/ui/app/templates/application.hbs  |  5 ++
 .../components/top-application-bar.hbs          | 10 +++-
 .../resources/ui/app/templates/password.hbs     | 48 ++++++++++++++++++++
 20 files changed, 322 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
index 45fc786..4b218b1 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/JdbcConnector.java
@@ -36,6 +36,7 @@ import org.apache.ambari.view.hive20.actor.message.ResultInformation;
 import org.apache.ambari.view.hive20.actor.message.ResultNotReady;
 import org.apache.ambari.view.hive20.actor.message.RunStatement;
 import org.apache.ambari.view.hive20.actor.message.SQLStatementJob;
+import org.apache.ambari.view.hive20.actor.message.job.AuthenticationFailed;
 import org.apache.ambari.view.hive20.actor.message.job.CancelJob;
 import org.apache.ambari.view.hive20.actor.message.job.ExecuteNextStatement;
 import org.apache.ambari.view.hive20.actor.message.job.ExecutionFailed;
@@ -397,24 +398,34 @@ public class JdbcConnector extends HiveActor {
   }
 
   private void notifyConnectFailure(Exception ex) {
+    boolean loginError = false;
     executing = false;
     isFailure = true;
     this.failure = new Failure("Cannot connect to hive", ex);
+    if(ex instanceof ConnectionException){
+      ConnectionException connectionException = (ConnectionException) ex;
+      Throwable cause = connectionException.getCause();
+      if(cause instanceof SQLException){
+        SQLException sqlException = (SQLException) cause;
+        if(isLoginError(sqlException))
+          loginError = true;
+      }
+    }
+
     if (isAsync()) {
       updateJobStatus(jobId.get(), Job.JOB_STATE_ERROR);
 
-      if(ex instanceof ConnectionException){
-        ConnectionException connectionException = (ConnectionException) ex;
-        Throwable cause = connectionException.getCause();
-        if(cause instanceof SQLException){
-          SQLException sqlException = (SQLException) cause;
-          if(isLoginError(sqlException))
-            return;
-        }
+      if (loginError) {
+        return;
       }
 
     } else {
-      sender().tell(new ExecutionFailed("Cannot connect to hive"), ActorRef.noSender());
+      if (loginError) {
+        sender().tell(new AuthenticationFailed("Hive authentication error", ex), ActorRef.noSender());
+      } else {
+        sender().tell(new ExecutionFailed("Cannot connect to hive", ex), ActorRef.noSender());
+      }
+
     }
     // Do not clean up in case of failed authorizations
     // The failure is bubbled to the user for requesting credentials

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AuthenticationFailed.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AuthenticationFailed.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AuthenticationFailed.java
new file mode 100644
index 0000000..c6885d1
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AuthenticationFailed.java
@@ -0,0 +1,27 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.hive20.actor.message.job;
+
+public class AuthenticationFailed extends Failure {
+
+  public AuthenticationFailed(String message, Throwable error) {
+    super(message, error);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java
index 1efb132..00ea46c 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java
@@ -18,7 +18,7 @@
 
 package org.apache.ambari.view.hive20.actor.message.job;
 
-public class Failure {
+public class Failure extends Exception {
   private final Throwable error;
   private final String message;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
index ef4f100..d6756ef 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/client/DDLDelegatorImpl.java
@@ -29,6 +29,7 @@ import org.apache.ambari.view.hive20.actor.message.ExecuteJob;
 import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob;
 import org.apache.ambari.view.hive20.actor.message.HiveJob;
 import org.apache.ambari.view.hive20.actor.message.SQLStatementJob;
+import org.apache.ambari.view.hive20.actor.message.job.AuthenticationFailed;
 import org.apache.ambari.view.hive20.actor.message.job.ExecutionFailed;
 import org.apache.ambari.view.hive20.actor.message.job.FetchFailed;
 import org.apache.ambari.view.hive20.actor.message.job.Next;
@@ -230,6 +231,10 @@ public class DDLDelegatorImpl implements DDLDelegator {
       LOG.error("Failed to get the table description");
       throw new ServiceFormattedException(error.getMessage(), error.getError());
 
+    } else if (submitResult instanceof AuthenticationFailed) {
+      AuthenticationFailed exception = (AuthenticationFailed) submitResult;
+      LOG.error("Failed to connect to Hive", exception.getMessage());
+      throw new ServiceFormattedException(exception.getMessage(), exception.getError(), 401);
     } else if (submitResult instanceof ResultSetHolder) {
       ResultSetHolder holder = (ResultSetHolder) submitResult;
       ActorRef iterator = holder.getIterator();

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/ConnectionService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/ConnectionService.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/ConnectionService.java
index 30fda79..dff72af 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/ConnectionService.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/ConnectionService.java
@@ -18,6 +18,9 @@
 
 package org.apache.ambari.view.hive20.resources.browser;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import com.google.common.base.Optional;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.hive20.AuthParams;
@@ -74,7 +77,11 @@ public class ConnectionService {
       Optional<String> password = instance.getPassword(context);
       if (!password.isPresent()) {
         // No password cached - request for one
-        return Response.status(Response.Status.UNAUTHORIZED).build();
+        JSONObject entity = new JSONObject();
+        Map<String, String> errors = new HashMap<>();
+        errors.put("message", "Ldap password required");
+        entity.put("errors", errors);
+        return Response.status(Response.Status.UNAUTHORIZED).entity(entity).build();
       }
       // if there was a password cached, make a connection attempt
       // get the password
@@ -105,9 +112,13 @@ public class ConnectionService {
           // check the message to see if the cause was a login failure
           // return a 401
           // else return a 500
-          if(isLoginError(e))
-            return Response.status(Response.Status.UNAUTHORIZED).build();
-          else
+          if(isLoginError(e)) {
+            JSONObject entity = new JSONObject();
+            Map<String, String> errors = new HashMap<>();
+            errors.put("message", "Authentication Exception");
+            entity.put("errors", errors);
+            return Response.status(Response.Status.UNAUTHORIZED).entity(entity).build();
+          } else
               throw new ServiceFormattedException(e.getMessage(), e);
         } finally {
           try {
@@ -137,7 +148,7 @@ public class ConnectionService {
             //Cache the password for the user
             ConnectionSystem instance = ConnectionSystem.getInstance();
             instance.persistCredentials(context.getUsername(),request.password);
-            return getOKResponse();
+            return attemptHiveConnection(request.password);
         } catch (WebApplicationException ex) {
             throw ex;
         } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/JobService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/JobService.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/JobService.java
index b5f92ac..f2e4ee9 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/JobService.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/JobService.java
@@ -142,7 +142,7 @@ public class JobService extends BaseService {
           if(th instanceof SQLException){
             SQLException sqlException = (SQLException) th;
             if(sqlException.getSQLState().equals("AUTHFAIL") && ConnectionFactory.isLdapEnabled(context))
-              return Response.status(401).build();
+              throw new ServiceFormattedException("Hive Authentication failed", sqlException, 401);
           }
           throw new Exception(th);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/adapters/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/adapters/application.js b/contrib/views/hive20/src/main/resources/ui/app/adapters/application.js
index 9cc8658..42935fc 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/adapters/application.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/adapters/application.js
@@ -21,6 +21,8 @@ import DS from 'ember-data';
 import ENV from 'ui/config/environment';
 
 export default DS.RESTAdapter.extend({
+  ldapAuth: Ember.inject.service(),
+
   init: function () {
     Ember.$.ajaxSetup({
       cache: false
@@ -55,13 +57,21 @@ export default DS.RESTAdapter.extend({
       // In development mode when the UI is served using ember serve the xhr requests are proxied to ambari server
       // by setting the proxyurl parameter in ember serve and for ambari to authenticate the requests, it needs this
       // basic authorization. This is for default admin/admin username/password combination.
-      headers['Authorization'] = 'Basic YWRtaW46YWRtaW4=';
+      //headers['Authorization'] = 'Basic YWRtaW46YWRtaW4=';
       //headers['Authorization'] = 'Basic aGl2ZTpoaXZl';
       //headers['Authorization'] = 'Basic ZGlwYXlhbjpkaXBheWFu';
     }
     return headers;
   }),
 
+
+  handleResponse(status, headers, payload, requestData) {
+    if (status == 401) {
+      this.get('ldapAuth').askPassword();
+    }
+    return this._super(...arguments);
+  },
+
   parseErrorResponse(responseText) {
     let json = this._super(responseText);
     if (Ember.isEmpty(json.errors)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/adapters/auth.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/adapters/auth.js b/contrib/views/hive20/src/main/resources/ui/app/adapters/auth.js
new file mode 100644
index 0000000..0a493b1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/adapters/auth.js
@@ -0,0 +1,27 @@
+/**
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import ApplicationAdapter from './application';
+
+export default ApplicationAdapter.extend({
+
+  authenticate(password){
+    let url = this.buildURL() + '/connection/auth';
+    return this.ajax(url, 'POST', {data: {'password': password}});
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/components/top-application-bar.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/top-application-bar.js b/contrib/views/hive20/src/main/resources/ui/app/components/top-application-bar.js
index bef9b51..f993a5e 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/components/top-application-bar.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/top-application-bar.js
@@ -19,5 +19,6 @@
 import Ember from 'ember';
 
 export default Ember.Component.extend({
-  service: false
+  service: false,
+  askPassword: false
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/application.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/application.js
index beb97e6..d5717a2 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/controllers/application.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/application.js
@@ -21,8 +21,11 @@ import ENV from 'ui/config/environment';
 
 export default Ember.Controller.extend({
   serviceCheck: Ember.inject.service(),
+  ldapAuth: Ember.inject.service(),
 
-  serviceCheckCompleted: Ember.computed('serviceCheck.transitionToApplication', function() {
+  serviceCheckCompleted: Ember.computed('serviceCheck.transitionToApplication', 'ldapAuth.passwordRequired', function() {
+    if(this.get('ldapAuth.passwordRequired'))
+      return false;
     return !ENV.APP.SHOULD_PERFORM_SERVICE_CHECK || this.get('serviceCheck.transitionToApplication');
   })
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/controllers/password.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/password.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/password.js
new file mode 100644
index 0000000..30899b6
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/password.js
@@ -0,0 +1,44 @@
+/**
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+  loginError: null,
+
+  isValid(password) {
+    this.set('loginError');
+    this.set('error');
+    this.set('errorText');
+    if (Ember.isEmpty(password)) {
+      this.set('error', true);
+      this.set('errorText', "Password cannot be empty");
+      return false;
+    }
+    return true;
+  },
+
+  actions: {
+    login(password) {
+      if (!this.isValid(password)) {
+        return false;
+      }
+      return true;
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/controllers/service-check.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/service-check.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/service-check.js
index 4183c1c..e5eb48d 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/controllers/service-check.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/service-check.js
@@ -25,6 +25,14 @@ export default Ember.Controller.extend({
   atsError: null,
   hiveError: null,
 
+  reset() {
+    this.set('hdfsError');
+    this.set('userHomeError');
+    this.set('atsError');
+    this.set('hiveError');
+
+  },
+
   progressStyle: Ember.computed('serviceCheck.percentCompleted', function() {
     let percentCompleted = this.get('serviceCheck.percentCompleted');
     return `width: ${percentCompleted}%;`;

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/router.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/router.js b/contrib/views/hive20/src/main/resources/ui/app/router.js
index d5d876d..3322642 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/router.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/router.js
@@ -26,6 +26,7 @@ const Router = Ember.Router.extend({
 
 Router.map(function() {
   this.route('service-check');
+  this.route('password');
 
   this.route('jobs');
   this.route('udfs', function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/application.js b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
index 448fad2..1baedb9 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
@@ -22,6 +22,14 @@ import ENV from 'ui/config/environment';
 
 export default Ember.Route.extend({
   serviceCheck: Ember.inject.service(),
+  ldapAuth: Ember.inject.service(),
+
+
+  init() {
+    this.get('ldapAuth').on('ask-password', this.askPassword.bind(this));
+    this.get('ldapAuth').on('password-provided', this.passwordProvided.bind(this));
+    return this._super(...arguments);
+  },
 
   beforeModel() {
     if (ENV.APP.SHOULD_PERFORM_SERVICE_CHECK && !this.get('serviceCheck.checkCompleted')) {
@@ -32,6 +40,15 @@ export default Ember.Route.extend({
   setupController: function (controller, model) {
     this._super(controller, model);
     controller.set('tabs', tabs);
+  },
+
+  askPassword() {
+    this.set('ldapAuth.passwordRequired', true);
+    this.transitionTo('password');
+  },
+
+  passwordProvided() {
+    this.refresh();
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/routes/password.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/password.js b/contrib/views/hive20/src/main/resources/ui/app/routes/password.js
new file mode 100644
index 0000000..b1aae6f
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/password.js
@@ -0,0 +1,41 @@
+/**
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import Ember from 'ember';
+import UILoggerMixin from '../mixins/ui-logger';
+
+export default Ember.Route.extend(UILoggerMixin, {
+  ldapAuth: Ember.inject.service(),
+
+  setupController(controller, model) {
+    controller.set('password', '');
+    this.get('logger').clearMessages();
+    this._super(...arguments);
+  },
+
+  actions: {
+    login(password) {
+      this.get('ldapAuth').authenticate(password).then(() => {
+        this.set('ldapAuth.passwordRequired', false);
+        this.get('ldapAuth').passwordProvided();
+      }).catch(() => {
+        this.controller.set('loginError', "Failed to login to hive");
+      });
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/routes/service-check.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/service-check.js b/contrib/views/hive20/src/main/resources/ui/app/routes/service-check.js
index b6887d1..7023a54 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/service-check.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/service-check.js
@@ -38,6 +38,7 @@ export default Ember.Route.extend({
 
   afterModel(){
     let controller = this.controllerFor("service-check");
+    controller.reset();
     controller.set("serviceCheckPolicy", this.get("serviceCheckPolicy"));
     this.get('serviceCheck').check(this.get("serviceCheckPolicy")).then((data) => {
       if(data.userHomePromise.state === 'rejected') {

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/services/ldap-auth.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/ldap-auth.js b/contrib/views/hive20/src/main/resources/ui/app/services/ldap-auth.js
new file mode 100644
index 0000000..d64afb9
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/ldap-auth.js
@@ -0,0 +1,35 @@
+/**
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Service.extend(Ember.Evented, {
+  passwordRequired: false,
+  store: Ember.inject.service(),
+  askPassword() {
+    this.trigger('ask-password');
+  },
+
+  passwordProvided() {
+    this.trigger('password-provided')
+  },
+
+  authenticate(password) {
+    return this.get('store').adapterFor('auth').authenticate(password);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
index ea532df..53b2192 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
@@ -29,12 +29,17 @@
         {{#tabs-pane tabs=tabs as |tab|}}
           {{tabs-item tab=tab tabs=tabs}}
         {{/tabs-pane}}
+      {{else if ldapAuth.passwordRequired}}
+        {{top-application-bar askPassword=true}}
       {{else}}
         {{top-application-bar service=true}}
       {{/if}}
 
     </div>
   </div>
+  {{#if askPassword}}
+    ASKING PASSWORD
+  {{/if}}
   <div class="row">
     <div class="main-wrapper clearfix">
       <div class="col-md-12">

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
index 029db66..8cdb779 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
@@ -17,8 +17,14 @@
 }}
 
 <h3 class="clearfix">
-  <strong>HIVE {{#if service}}<small>SERVICE CHECKS</small>{{/if}}</strong>
-  {{#if (not service)}}
+  <strong>HIVE
+    {{#if service}}
+      <small>SERVICE CHECKS</small>
+    {{else if askPassword}}
+      <small>PASSWORD</small>
+    {{/if}}
+  </strong>
+  {{#if (not (or service askPassword))}}
     <span class="pull-right">
       {{#link-to 'queries.new' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW JOB{{/link-to}}
       {{#link-to 'databases.newtable' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW TABLE{{/link-to}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/934a5bcc/contrib/views/hive20/src/main/resources/ui/app/templates/password.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/password.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/password.hbs
new file mode 100644
index 0000000..bf9f8aa
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/password.hbs
@@ -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
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* 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.
+}}
+
+<div class="col-md-offset-2 col-md-8">
+  <div class="col-md-12 text-center">
+    <div class="alert alert-danger">
+      <p class="lead">Hive Authentication Password Required</p>
+    </div>
+  </div>
+
+  <div class="col-md-offset-2 col-md-8 form-horizontal">
+    <div class="form-group {{if error 'has-error'}}">
+      <label class="col-sm-2 control-label">Password</label>
+      <div class="col-sm-8">
+        {{input type="password" class="form-control" value=password}}
+        <span class="help-block">{{errorText}}</span>
+      </div>
+      <div class="col-sm-2">
+        <button type="submit" class="btn btn-success" {{action "login" password}}>Login</button>
+      </div>
+    </div>
+    {{#if loginError}}
+      <div class="row">
+        <div class="col-md-offset-2 col-md-8 text-center">
+          <div class="alert alert-danger ">
+            <p>{{loginError}}</p>
+          </div>
+        </div>
+      </div>
+    {{/if}}
+  </div>
+
+</div>