You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/01/05 00:04:57 UTC

[16/50] [abbrv] ambari git commit: AMBARI-19321 : Hive View 2.0 - Minimal view for Hive which includes new UI changes. Also made changes in poms as required (nitirajrathore)

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/DefaultSupplier.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/DefaultSupplier.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/DefaultSupplier.java
new file mode 100644
index 0000000..a9edbe7
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/DefaultSupplier.java
@@ -0,0 +1,60 @@
+/*
+ * 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.internal;
+
+import com.google.common.base.Supplier;
+
+/**
+ * Create instances of classes
+ * for which no constructors have been specified
+ * @param <T>
+ */
+public class DefaultSupplier<T> implements Supplier<T>{
+
+    private Class<T> clazz;
+    T instance;
+
+    public DefaultSupplier(T instance) {
+        this.instance = instance;
+    }
+
+    public DefaultSupplier(Class<T> clazz) throws IllegalAccessException, InstantiationException {
+        this.clazz = clazz;
+    }
+
+    /**
+     * Get the instance
+     * @return
+     */
+    @Override
+    public T get() {
+        if(clazz != null){
+            try {
+                return clazz.newInstance();
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+                return null;
+            } catch (IllegalAccessException e) {
+                return null;
+            }
+        } else {
+            return instance;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/Either.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/Either.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/Either.java
new file mode 100644
index 0000000..9b47148
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/Either.java
@@ -0,0 +1,79 @@
+/*
+ * 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.internal;
+
+import com.google.common.base.Optional;
+
+/**
+ * Simple implementation of a container class which can
+ * hold one of two values
+ * <p>
+ * Callers should check if the value if left or right before
+ * trying to get the value
+ *
+ * @param <L> Left Value
+ * @param <R> Right value
+ */
+public class Either<L, R> {
+
+  private final Optional<L> left;
+  private final Optional<R> right;
+
+
+  public boolean isLeft() {
+    return left.isPresent() && !right.isPresent();
+  }
+
+  public boolean isRight() {
+    return !left.isPresent() && right.isPresent();
+  }
+
+  public boolean isNone() { return  !(left.isPresent() || right.isPresent()); }
+
+  public L getLeft() {
+    return left.orNull();
+  }
+
+  public R getRight() {
+    return right.orNull();
+  }
+
+
+  private Either(Optional<L> left, Optional<R> right) {
+    this.left = left;
+    this.right = right;
+  }
+
+
+  public static <L, R> Either<L, R> left(L value) {
+    return new Either<>(Optional.of(value), Optional.<R>absent());
+  }
+
+  public static <L, R> Either<L, R> right(R value) {
+    return new Either<>(Optional.<L>absent(), Optional.of(value));
+  }
+
+  public static <L, R> Either<L, R> none() {
+    return new Either<>(Optional.<L>absent(), Optional.<R>absent());
+  }
+
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HdfsApiSupplier.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HdfsApiSupplier.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HdfsApiSupplier.java
new file mode 100644
index 0000000..e66b9ab
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HdfsApiSupplier.java
@@ -0,0 +1,63 @@
+/*
+ * 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.internal;
+
+import com.google.common.base.Optional;
+import org.apache.ambari.view.ViewContext;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class HdfsApiSupplier implements ContextSupplier<Optional<HdfsApi>> {
+
+  protected final Logger LOG =
+    LoggerFactory.getLogger(getClass());
+
+  private static final Map<String, HdfsApi> hdfsApiMap = new ConcurrentHashMap<>();
+  private final Object lock = new Object();
+
+  @Override
+  public Optional<HdfsApi> get(ViewContext context) {
+    try {
+      if(!hdfsApiMap.containsKey(getKey(context))) {
+        synchronized (lock) {
+          if(!hdfsApiMap.containsKey(getKey(context))) {
+            LOG.debug("Creating HDFSApi instance for Viewname: {}, Instance Name: {}", context.getViewName(), context.getInstanceName());
+            HdfsApi api = HdfsUtil.connectToHDFSApi(context);
+            hdfsApiMap.put(getKey(context), api);
+            return Optional.of(api);
+          }
+        }
+      }
+      return Optional.of(hdfsApiMap.get(getKey(context)));
+    } catch (HdfsApiException e) {
+      LOG.error("Cannot get the HDFS API", e);
+      return Optional.absent();
+    }
+  }
+
+  private String getKey(ViewContext context) {
+    return context.getUsername() + ":" + context.getInstanceName();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveConnectionWrapper.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveConnectionWrapper.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveConnectionWrapper.java
new file mode 100644
index 0000000..f5f1ff1
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveConnectionWrapper.java
@@ -0,0 +1,152 @@
+/*
+ * 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.internal;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
+import org.apache.ambari.view.hive20.AuthParams;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hive.jdbc.HiveConnection;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.PrivilegedExceptionAction;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Composition over a Hive jdbc connection
+ * This class only provides a connection over which
+ * callers should run their own JDBC statements
+ */
+public class HiveConnectionWrapper implements Connectable, Supplier<HiveConnection> {
+
+  private static String DRIVER_NAME = "org.apache.hive.jdbc.HiveDriver";
+  public static final String SUFFIX = "validating the login";
+  private final String jdbcUrl;
+  private final String username;
+  private final String password;
+  private final AuthParams authParams;
+
+  private UserGroupInformation ugi;
+
+  private HiveConnection connection = null;
+  private boolean authFailed;
+
+  public HiveConnectionWrapper(String jdbcUrl, String username, String password, AuthParams authParams) {
+    this.jdbcUrl = jdbcUrl;
+    this.username = username;
+    this.password = password;
+    this.authParams = authParams;
+  }
+
+  @Override
+  public void connect() throws ConnectionException {
+    try {
+      Class.forName(DRIVER_NAME);
+    } catch (ClassNotFoundException e) {
+      throw new ConnectionException(e, "Cannot load the hive JDBC driver");
+    }
+
+    try {
+      ugi = UserGroupInformation.createProxyUser(username, authParams.getProxyUser());
+    } catch (IOException e) {
+      throw new ConnectionException(e, "Cannot set kerberos authentication for getting connection.");
+    }
+
+    try {
+      Connection conn = ugi.doAs(new PrivilegedExceptionAction<Connection>() {
+        @Override
+        public Connection run() throws Exception {
+          return DriverManager.getConnection(jdbcUrl, username, password);
+        }
+      });
+      connection = (HiveConnection) conn;
+    } catch (UndeclaredThrowableException exception) {
+      // Check if the reason was an auth error
+      Throwable undeclaredThrowable = exception.getUndeclaredThrowable();
+      if (undeclaredThrowable instanceof SQLException) {
+        SQLException sqlException = (SQLException) undeclaredThrowable;
+        if (isLoginError(sqlException))
+          authFailed = true;
+        throw new ConnectionException(sqlException, "Cannot open a hive connection with connect string " + jdbcUrl);
+      }
+
+    } catch (IOException | InterruptedException e) {
+      throw new ConnectionException(e, "Cannot open a hive connection with connect string " + jdbcUrl);
+    }
+
+  }
+
+  @Override
+  public void reconnect() throws ConnectionException {
+
+  }
+
+  @Override
+  public void disconnect() throws ConnectionException {
+    if (connection != null) {
+      try {
+        connection.close();
+      } catch (SQLException e) {
+        throw new ConnectionException(e, "Cannot close the hive connection with connect string " + jdbcUrl);
+      }
+    }
+  }
+
+  private boolean isLoginError(SQLException ce) {
+    return ce.getCause().getMessage().toLowerCase().endsWith(SUFFIX);
+  }
+
+  /**
+   * True when the connection is unauthorized
+   *
+   * @return
+   */
+  @Override
+  public boolean isUnauthorized() {
+    return authFailed;
+  }
+
+  public Optional<HiveConnection> getConnection() {
+    return Optional.fromNullable(connection);
+  }
+
+  @Override
+  public boolean isOpen() {
+    try {
+      return connection != null && !connection.isClosed() && connection.isValid(100);
+    } catch (SQLException e) {
+      // in case of an SQ error just return
+      return false;
+    }
+  }
+
+  /**
+   * Retrieves an instance of the appropriate type. The returned object may or
+   * may not be a new instance, depending on the implementation.
+   *
+   * @return an instance of the appropriate type
+   */
+  @Override
+  public HiveConnection get() {
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveQuery.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveQuery.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveQuery.java
new file mode 100644
index 0000000..5ab384e
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveQuery.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     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.internal;
+
+
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+
+import javax.annotation.Nullable;
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Holder for query submitted by the user
+ * This may contain multiple hive queries
+ */
+public class HiveQuery {
+
+    private String query;
+
+    public HiveQuery(String query) {
+        this.query = query;
+    }
+
+    public HiveQueries fromMultiLineQuery(String multiLineQuery){
+        return new HiveQueries(multiLineQuery);
+    }
+
+
+    public static class HiveQueries{
+
+        static final String QUERY_SEP = ";";
+        Collection<HiveQuery> hiveQueries;
+
+        private HiveQueries(String userQuery) {
+            hiveQueries = FluentIterable.from(Arrays.asList(userQuery.split(QUERY_SEP)))
+                    .transform(new Function<String, HiveQuery>() {
+                        @Nullable
+                        @Override
+                        public HiveQuery apply(@Nullable String input) {
+                            return new HiveQuery(input.trim());
+                        }
+                    }).toList();
+        }
+
+
+
+
+
+    }
+
+
+
+
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveResult.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveResult.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveResult.java
new file mode 100644
index 0000000..6e47e46
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveResult.java
@@ -0,0 +1,160 @@
+/*
+ * 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.internal;
+
+import com.google.common.collect.Lists;
+
+import java.math.RoundingMode;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+public class HiveResult implements Iterator<HiveResult.Row> {
+
+    public static final String NULL = "NULL";
+    private static final int DEFAULT_BATCH_SIZE = 50;
+    private static ResultSetMetaData metaData;
+    private Row colNames;
+    private NumberFormat nf = new DecimalFormat();
+    private List<Row> rows = Lists.newArrayList();
+
+    public HiveResult(ResultSet rs) throws SQLException {
+        nf.setRoundingMode(RoundingMode.FLOOR);
+        nf.setMinimumFractionDigits(0);
+        nf.setMaximumFractionDigits(2);
+        metaData = rs.getMetaData();
+        int columnCount = metaData.getColumnCount();
+        colNames = new Row(columnCount);
+        int index = 0;
+        while (rs.next() && index <DEFAULT_BATCH_SIZE){
+            index ++;
+            rows.add(new Row(columnCount,rs));
+        }
+
+
+    }
+
+    public List<Row> getRows(){
+        return rows;
+    }
+
+    public List<Row> getData() {
+        return rows;
+    }
+
+    /**
+     * use the lists iterator
+     *
+     * @return {@code true} if the iteration has more elements
+     */
+    @Override
+    public boolean hasNext() {
+        return rows.iterator().hasNext();
+    }
+
+    /**
+     * Returns the next row in the iteration.
+     *
+     * @return the next element in the iteration
+     */
+    @Override
+    public Row next() {
+        return rows.iterator().next();
+    }
+
+    /**
+     * Removes from the underlying collection the last element returned
+     * by this iterator (optional operation).  This method can be called
+     * only once per call to {@link #next}.  The behavior of an iterator
+     * is unspecified if the underlying collection is modified while the
+     * iteration is in progress in any way other than by calling this
+     * method.
+     *
+     * @throws UnsupportedOperationException if the {@code remove}
+     *                                       operation is not supported by this iterator
+     * @throws IllegalStateException         if the {@code next} method has not
+     *                                       yet been called, or the {@code remove} method has already
+     *                                       been called after the last call to the {@code next}
+     *                                       method
+     */
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
+
+    public Row getColNames() {
+        return colNames;
+    }
+
+
+    @Override
+    public String toString() {
+        return "HiveResult{" +
+                "colNames=" + colNames +
+                ", rows=" + rows +
+                '}';
+    }
+
+    public class Row {
+        String[] values;
+
+        public Row(int size) throws SQLException {
+            values = new String[size];
+            for (int i = 0; i < size; i++) {
+                values[i] = metaData.getColumnLabel(i + 1);
+            }
+        }
+
+
+        public Row(int size, ResultSet rs) throws SQLException {
+            values = new String[size];
+            for (int i = 0; i < size; i++) {
+                if (nf != null) {
+                    Object object = rs.getObject(i + 1);
+                    if (object == null) {
+                        values[i] = null;
+                    } else if (object instanceof Number) {
+                        values[i] = nf.format(object);
+                    } else {
+                        values[i] = object.toString();
+                    }
+                } else {
+                    values[i] = rs.getString(i + 1);
+                }
+                values[i] = values[i] == null ? NULL : values[i];
+
+            }
+
+        }
+
+        @Override
+        public String toString() {
+            return "Row{" +
+                    "values=" + Arrays.toString(values) +
+                    '}';
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTask.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTask.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTask.java
new file mode 100644
index 0000000..243de7b
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTask.java
@@ -0,0 +1,53 @@
+/*
+ * 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.internal;
+
+public interface HiveTask {
+
+    /**
+     * The task id for this task
+     * @return task Id
+     */
+    Long getId();
+
+    /**
+     * The user for which this task was submitted
+     * @return
+     */
+    String getUser();
+
+    /**
+     * The view instance tied to this task
+     * @return
+     */
+    String getInstance();
+
+    /**
+     * Connection properties pulled from the view context and request
+     * @return
+     */
+
+    //Connectable getConnectionClass();
+
+    ConnectionProperties getConnectionProperties();
+
+    HiveQuery.HiveQueries getQueries();
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTaskMessage.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTaskMessage.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTaskMessage.java
new file mode 100644
index 0000000..532cea7
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/HiveTaskMessage.java
@@ -0,0 +1,118 @@
+/*
+ * 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.internal;
+
+public class HiveTaskMessage implements HiveTask {
+
+    private Long id;
+    private String instance;
+    private ConnectionProperties connectionProps;
+    private HiveQuery.HiveQueries queries;
+    //private Connectable connectable = new HiveConnectionWrapper(connectMessage);
+
+
+    public void setConnectionProps(ConnectionProperties connectionProps) {
+        this.connectionProps = connectionProps;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setInstance(String instance) {
+        this.instance = instance;
+    }
+
+    public void setQueries(HiveQuery.HiveQueries queries) {
+        this.queries = queries;
+    }
+
+
+    /*public void setConnectable(Connectable connectable) {
+        this.connectable = connectable;
+    }*/
+
+    /**
+     * The task id for this task
+     *
+     * @return task Id
+     */
+    @Override
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * The user for which this task was submitted
+     *
+     * @return
+     */
+    @Override
+    public String getUser() {
+        return connectionProps.getUserName();
+    }
+
+    /**
+     * The view instance tied to this task
+     *
+     * @return
+     */
+    @Override
+    public String getInstance() {
+        return instance;
+    }
+
+    /**
+     * Connection properties pulled from the view context and request
+     *
+     * @return
+     */
+    /*@Override
+    public Connectable getConnectionClass() {
+        return connectable;
+    }
+*/
+    /**
+     * Connection properties pulled from the view context and request
+     *
+     * @return
+     */
+    @Override
+    public ConnectionProperties getConnectionProperties() {
+        return connectionProps;
+    }
+
+    @Override
+    public HiveQuery.HiveQueries getQueries() {
+        return queries;
+    }
+
+
+    @Override
+    public String toString() {
+        return "HiveTaskMessage{" +
+                "connectionProps=" + connectionProps +
+                ", id=" + id +
+                ", instance='" + instance + '\'' +
+                ", queries=" + queries +
+                '}';
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/SafeViewContext.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/SafeViewContext.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/SafeViewContext.java
new file mode 100644
index 0000000..2f9f337
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/SafeViewContext.java
@@ -0,0 +1,179 @@
+/*
+ * 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.internal;
+
+import org.apache.ambari.view.AmbariStreamProvider;
+import org.apache.ambari.view.DataStore;
+import org.apache.ambari.view.HttpImpersonator;
+import org.apache.ambari.view.ImpersonatorSetting;
+import org.apache.ambari.view.ResourceProvider;
+import org.apache.ambari.view.SecurityException;
+import org.apache.ambari.view.URLConnectionProvider;
+import org.apache.ambari.view.URLStreamProvider;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.ViewController;
+import org.apache.ambari.view.ViewDefinition;
+import org.apache.ambari.view.ViewInstanceDefinition;
+import org.apache.ambari.view.cluster.Cluster;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Wrapper to ViewContext. This delegates all the method calls to wrapped ViewContext object excepting for
+ * #getUsername() and #getLoggedinUser(). At the creation time, the username and loggedinuser are store
+ * in instance variable. This was done to bypass the ThreadLocal variables implicitly used in actual viewContext.
+ * So, object of this class should be used in the ActorSystem.
+ */
+public class SafeViewContext implements ViewContext {
+  private final ViewContext viewContext;
+  private final String username;
+  private final String loggedinUser;
+
+  public SafeViewContext(ViewContext viewContext) {
+    this.viewContext = viewContext;
+    username = viewContext.getUsername();
+    loggedinUser = viewContext.getLoggedinUser();
+  }
+
+  @Override
+  public String getUsername() {
+    return username;
+  }
+
+  @Override
+  public String getLoggedinUser() {
+    return loggedinUser;
+  }
+
+  @Override
+  public void hasPermission(String userName, String permissionName) throws SecurityException {
+    viewContext.hasPermission(userName, permissionName);
+  }
+
+  @Override
+  public String getViewName() {
+    return viewContext.getViewName();
+  }
+
+  @Override
+  public ViewDefinition getViewDefinition() {
+    return viewContext.getViewDefinition();
+  }
+
+  @Override
+  public String getInstanceName() {
+    return viewContext.getInstanceName();
+  }
+
+  @Override
+  public ViewInstanceDefinition getViewInstanceDefinition() {
+    return viewContext.getViewInstanceDefinition();
+  }
+
+  @Override
+  public Map<String, String> getProperties() {
+    return viewContext.getProperties();
+  }
+
+  @Override
+  public void putInstanceData(String key, String value) {
+    viewContext.putInstanceData(key, value);
+  }
+
+  @Override
+  public String getInstanceData(String key) {
+    return viewContext.getInstanceData(key);
+  }
+
+  @Override
+  public Map<String, String> getInstanceData() {
+    return viewContext.getInstanceData();
+  }
+
+  @Override
+  public void removeInstanceData(String key) {
+    viewContext.removeInstanceData(key);
+  }
+
+  @Override
+  public String getAmbariProperty(String key) {
+    return viewContext.getAmbariProperty(key);
+  }
+
+  @Override
+  public ResourceProvider<?> getResourceProvider(String type) {
+    return viewContext.getResourceProvider(type);
+  }
+
+  @Override
+  public URLStreamProvider getURLStreamProvider() {
+    return viewContext.getURLStreamProvider();
+  }
+
+  @Override
+  public URLConnectionProvider getURLConnectionProvider() {
+    return viewContext.getURLConnectionProvider();
+  }
+
+  @Override
+  public AmbariStreamProvider getAmbariStreamProvider() {
+    return viewContext.getAmbariStreamProvider();
+  }
+
+  @Override
+  public AmbariStreamProvider getAmbariClusterStreamProvider() {
+    return viewContext.getAmbariClusterStreamProvider();
+  }
+
+  @Override
+  public DataStore getDataStore() {
+    return viewContext.getDataStore();
+  }
+
+  @Override
+  public Collection<ViewDefinition> getViewDefinitions() {
+    return viewContext.getViewDefinitions();
+  }
+
+  @Override
+  public Collection<ViewInstanceDefinition> getViewInstanceDefinitions() {
+    return viewContext.getViewInstanceDefinitions();
+  }
+
+  @Override
+  public ViewController getController() {
+    return viewContext.getController();
+  }
+
+  @Override
+  public HttpImpersonator getHttpImpersonator() {
+    return viewContext.getHttpImpersonator();
+  }
+
+  @Override
+  public ImpersonatorSetting getImpersonatorSetting() {
+    return viewContext.getImpersonatorSetting();
+  }
+
+  @Override
+  public Cluster getCluster() {
+    return viewContext.getCluster();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnInfo.java
new file mode 100644
index 0000000..2876348
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnInfo.java
@@ -0,0 +1,117 @@
+/**
+ * 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.dto;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+/**
+ *
+ */
+public class ColumnInfo {
+  private String name;
+  // TODO : to be broken into datatype + precision + scale for better comparison
+  private String type;
+  private Integer precision;
+  private Integer scale;
+  private String comment;
+
+  public ColumnInfo(String name, String type, Integer precision, Integer scale, String comment) {
+    this.name = name;
+    this.type = type;
+    this.precision = precision;
+    this.scale = scale;
+    this.comment = comment;
+  }
+
+  public ColumnInfo(String name, String type, String comment) {
+    this.name = name;
+    this.type = type;
+    this.comment = comment;
+  }
+
+  public ColumnInfo(String name, String type) {
+    this.name = name;
+    this.type = type;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public Integer getPrecision() {
+    return precision;
+  }
+
+  public void setPrecision(Integer precision) {
+    this.precision = precision;
+  }
+
+  public Integer getScale() {
+    return scale;
+  }
+
+  public void setScale(Integer scale) {
+    this.scale = scale;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = name.hashCode();
+    result = 31 * result + type.hashCode();
+    result = 31 * result + (precision != null ? precision.hashCode() : 0);
+    result = 31 * result + (scale != null ? scale.hashCode() : 0);
+    result = 31 * result + (comment != null ? comment.hashCode() : 0);
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+
+    if (o == null || getClass() != o.getClass()) return false;
+
+    ColumnInfo that = (ColumnInfo) o;
+
+    return new EqualsBuilder()
+        .append(getName(), that.getName())
+        .append(getType(), that.getType())
+        .append(getComment(), that.getComment())
+        .isEquals();
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder("ColumnInfo{");
+    sb.append("name='").append(name).append('\'');
+    sb.append(", type='").append(type).append('\'');
+    sb.append(", precision=").append(precision);
+    sb.append(", scale=").append(scale);
+    sb.append(", comment='").append(comment).append('\'');
+    sb.append('}');
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnOrder.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnOrder.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnOrder.java
new file mode 100644
index 0000000..23757dc
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ColumnOrder.java
@@ -0,0 +1,54 @@
+/*
+* 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.internal.dto;
+
+public class ColumnOrder {
+  private String columnName;
+  private Order order;
+
+  public ColumnOrder(String columnName, Order order) {
+    this.columnName = columnName;
+    this.order = order;
+  }
+
+  public String getColumnName() {
+    return columnName;
+  }
+
+  public void setColumnName(String columnName) {
+    this.columnName = columnName;
+  }
+
+  public Order getOrder() {
+    return order;
+  }
+
+  public void setOrder(Order order) {
+    this.order = order;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder("ColumnOrder{");
+    sb.append("columnName='").append(columnName).append('\'');
+    sb.append(", order=").append(order);
+    sb.append('}');
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseInfo.java
new file mode 100644
index 0000000..d8ea207
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseInfo.java
@@ -0,0 +1,85 @@
+/**
+ * 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.dto;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * DTO object to store the Database info
+ */
+public class DatabaseInfo {
+  private String name;
+  private Set<TableInfo> tables = new HashSet<>();
+
+  public DatabaseInfo(String name) {
+    this.name = name;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Set<TableInfo> getTables() {
+    return tables;
+  }
+
+  public void setTables(Set<TableInfo> tables) {
+    this.tables = tables;
+  }
+
+  public void addTable(TableInfo tableInfo) {
+    this.tables.add(tableInfo);
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+
+    if (o == null || getClass() != o.getClass()) return false;
+
+    DatabaseInfo info = (DatabaseInfo) o;
+
+    return new EqualsBuilder()
+        .append(getName(), info.getName())
+        .isEquals();
+  }
+
+  @Override
+  public int hashCode() {
+    return new HashCodeBuilder(17, 37)
+        .append(getName())
+        .toHashCode();
+  }
+
+  @Override
+  public String toString() {
+    return "DatabaseInfo{" +
+        "name='" + name + '\'' +
+        ", tables=" + tables +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseResponse.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseResponse.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseResponse.java
new file mode 100644
index 0000000..3eb98f1
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DatabaseResponse.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.view.hive20.internal.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class DatabaseResponse {
+  private String id;
+  private String name;
+  private Set<TableResponse> tables;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Set<TableResponse> getTables() {
+    return tables;
+  }
+
+  public void addTable(TableResponse table) {
+    if(tables == null) {
+      tables = new HashSet<>();
+    }
+    tables.add(table);
+  }
+
+  public void addAllTables(Collection<TableResponse> tableResponses) {
+    if(tables == null) {
+      tables = new HashSet<>();
+    }
+    tables.addAll(tableResponses);
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DetailedTableInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DetailedTableInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DetailedTableInfo.java
new file mode 100644
index 0000000..84a562a
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/DetailedTableInfo.java
@@ -0,0 +1,124 @@
+/**
+ * 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.dto;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public class DetailedTableInfo {
+  private String tableName;
+  private String dbName;
+  private String owner;
+  private String createTime;
+  private String lastAccessTime;
+  private String retention;
+  private String tableType;
+  private String location;
+  private Map<String, String> parameters;
+
+
+  public String getTableName() {
+    return tableName;
+  }
+
+  public void setTableName(String tableName) {
+    this.tableName = tableName;
+  }
+
+  public String getDbName() {
+    return dbName;
+  }
+
+  public void setDbName(String dbName) {
+    this.dbName = dbName;
+  }
+
+  public String getOwner() {
+    return owner;
+  }
+
+  public void setOwner(String owner) {
+    this.owner = owner;
+  }
+
+  public String getCreateTime() {
+    return createTime;
+  }
+
+  public void setCreateTime(String createTime) {
+    this.createTime = createTime;
+  }
+
+  public String getLastAccessTime() {
+    return lastAccessTime;
+  }
+
+  public void setLastAccessTime(String lastAccessTime) {
+    this.lastAccessTime = lastAccessTime;
+  }
+
+  public String getRetention() {
+    return retention;
+  }
+
+  public void setRetention(String retention) {
+    this.retention = retention;
+  }
+
+  public String getTableType() {
+    return tableType;
+  }
+
+  public void setTableType(String tableType) {
+    this.tableType = tableType;
+  }
+
+  public Map<String, String> getParameters() {
+    return parameters;
+  }
+
+  public void setParameters(Map<String, String> parameters) {
+    this.parameters = parameters;
+  }
+
+  public String getLocation() {
+    return location;
+  }
+
+  public void setLocation(String location) {
+    this.location = location;
+  }
+
+  @Override
+  public String toString() {
+    return "DetailedTableInfo{" +
+        "tableName='" + tableName + '\'' +
+        ", dbName='" + dbName + '\'' +
+        ", owner='" + owner + '\'' +
+        ", createTime='" + createTime + '\'' +
+        ", lastAccessTime='" + lastAccessTime + '\'' +
+        ", retention='" + retention + '\'' +
+        ", tableType='" + tableType + '\'' +
+        ", location='" + location + '\'' +
+        ", parameters=" + parameters +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Order.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Order.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Order.java
new file mode 100644
index 0000000..42b7339
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Order.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.internal.dto;
+
+public enum Order {
+  DESC (0),
+  ASC (1);
+
+  private static Order[] allValues = values();
+  public static Order fromOrdinal(int n) {return allValues[n];}
+
+  private final int ordinal;
+
+  Order(int ordinal){
+    this.ordinal = ordinal;
+  }
+
+  public int getOrdinal(){
+    return ordinal;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/PartitionInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/PartitionInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/PartitionInfo.java
new file mode 100644
index 0000000..d9a428a
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/PartitionInfo.java
@@ -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
+ * <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.dto;
+
+import java.util.List;
+
+/**
+ *
+ */
+public class PartitionInfo {
+  private final List<ColumnInfo> columns;
+
+
+  public PartitionInfo(List<ColumnInfo> columns) {
+    this.columns = columns;
+  }
+
+  public List<ColumnInfo> getColumns() {
+    return columns;
+  }
+
+  @Override
+  public String toString() {
+    return "PartitionInfo{" +
+        "columns=" + columns +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Section.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Section.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Section.java
new file mode 100644
index 0000000..49f2a49
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/Section.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.dto;
+
+/**
+ *
+ */
+public abstract class Section {
+  private String sectionMarker;
+  private String sectionStartMarker;
+  private String sectionEndMarker;
+
+  public Section(String sectionMarker, String sectionStartMarker, String sectionEndMarker) {
+    this.sectionMarker = sectionMarker;
+    this.sectionStartMarker = sectionStartMarker;
+    this.sectionEndMarker = sectionEndMarker;
+  }
+
+  public String getSectionMarker() {
+    return sectionMarker;
+  }
+
+  public String getSectionStartMarker() {
+    return sectionStartMarker;
+  }
+
+  public String getSectionEndMarker() {
+    return sectionEndMarker;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/StorageInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/StorageInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/StorageInfo.java
new file mode 100644
index 0000000..0bd4b41
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/StorageInfo.java
@@ -0,0 +1,124 @@
+/**
+ * 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.dto;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ */
+public class StorageInfo {
+  private String serdeLibrary;
+  private String inputFormat;
+  private String outputFormat;
+  private String compressed;
+  private String numBuckets;
+  private List<String> bucketCols;
+  private List<ColumnOrder> sortCols;
+  private String fileFormat;
+  private Map<String, String> parameters;
+
+  public String getFileFormat() {
+    return fileFormat;
+  }
+
+  public void setFileFormat(String fileFormat) {
+    this.fileFormat = fileFormat;
+  }
+
+  public String getSerdeLibrary() {
+    return serdeLibrary;
+  }
+
+  public void setSerdeLibrary(String serdeLibrary) {
+    this.serdeLibrary = serdeLibrary;
+  }
+
+  public String getInputFormat() {
+    return inputFormat;
+  }
+
+  public void setInputFormat(String inputFormat) {
+    this.inputFormat = inputFormat;
+  }
+
+  public String getOutputFormat() {
+    return outputFormat;
+  }
+
+  public void setOutputFormat(String outputFormat) {
+    this.outputFormat = outputFormat;
+  }
+
+  public String getCompressed() {
+    return compressed;
+  }
+
+  public void setCompressed(String compressed) {
+    this.compressed = compressed;
+  }
+
+  public String getNumBuckets() {
+    return numBuckets;
+  }
+
+  public void setNumBuckets(String numBuckets) {
+    this.numBuckets = numBuckets;
+  }
+
+  public List<String> getBucketCols() {
+    return bucketCols;
+  }
+
+  public void setBucketCols(List<String> bucketCols) {
+    this.bucketCols = bucketCols;
+  }
+
+  public List<ColumnOrder> getSortCols() {
+    return sortCols;
+  }
+
+  public void setSortCols(List<ColumnOrder> sortCols) {
+    this.sortCols = sortCols;
+  }
+
+  public Map<String, String> getParameters() {
+    return parameters;
+  }
+
+  public void setParameters(Map<String, String> parameters) {
+    this.parameters = parameters;
+  }
+
+  @Override
+  public String toString() {
+    return "StorageInfo{" +
+        "serdeLibrary='" + serdeLibrary + '\'' +
+        ", inputFormat='" + inputFormat + '\'' +
+        ", outputFormat='" + outputFormat + '\'' +
+        ", compressed='" + compressed + '\'' +
+        ", numBuckets='" + numBuckets + '\'' +
+        ", bucketCols='" + bucketCols + '\'' +
+        ", sortCols='" + sortCols + '\'' +
+        ", fileFormat='" + fileFormat + '\'' +
+        ", parameters=" + parameters +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableInfo.java
new file mode 100644
index 0000000..41be0a0
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableInfo.java
@@ -0,0 +1,79 @@
+/**
+ * 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.dto;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+/**
+ * DTO object to store the Table information
+ */
+public class TableInfo {
+  private String name;
+  private String type;
+
+  public TableInfo(String name, String type) {
+    this.name = name;
+    this.type = type;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+
+    if (o == null || getClass() != o.getClass()) return false;
+
+    TableInfo info = (TableInfo) o;
+
+    return new EqualsBuilder()
+        .append(getName(), info.getName())
+        .isEquals();
+  }
+
+  @Override
+  public int hashCode() {
+    return new HashCodeBuilder(17, 37)
+        .append(getName())
+        .toHashCode();
+  }
+
+  @Override
+  public String toString() {
+    return "TableInfo{" +
+        "name='" + name + '\'' +
+        ", type='" + type + '\'' +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableMeta.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableMeta.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableMeta.java
new file mode 100644
index 0000000..f47e76c
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableMeta.java
@@ -0,0 +1,125 @@
+/**
+ * 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.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ */
+public class TableMeta implements Serializable{
+  private String id;
+  private String database;
+  private String table;
+  private List<ColumnInfo> columns;
+  private String ddl;
+  private PartitionInfo partitionInfo;
+  private DetailedTableInfo detailedInfo;
+  private StorageInfo storageInfo;
+  private ViewInfo viewInfo;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getDatabase() {
+    return database;
+  }
+
+  public void setDatabase(String database) {
+    this.database = database;
+  }
+
+  public String getTable() {
+    return table;
+  }
+
+  public void setTable(String table) {
+    this.table = table;
+  }
+
+  public List<ColumnInfo> getColumns() {
+    return columns;
+  }
+
+  public void setColumns(List<ColumnInfo> columns) {
+    this.columns = columns;
+  }
+
+  public String getDdl() {
+    return ddl;
+  }
+
+  public void setDdl(String ddl) {
+    this.ddl = ddl;
+  }
+
+  public PartitionInfo getPartitionInfo() {
+    return partitionInfo;
+  }
+
+  public void setPartitionInfo(PartitionInfo partitionInfo) {
+    this.partitionInfo = partitionInfo;
+  }
+
+  public DetailedTableInfo getDetailedInfo() {
+    return detailedInfo;
+  }
+
+  public void setDetailedInfo(DetailedTableInfo detailedInfo) {
+    this.detailedInfo = detailedInfo;
+  }
+
+  public StorageInfo getStorageInfo() {
+    return storageInfo;
+  }
+
+  public void setStorageInfo(StorageInfo storageInfo) {
+    this.storageInfo = storageInfo;
+  }
+
+  public ViewInfo getViewInfo() {
+    return viewInfo;
+  }
+
+  public void setViewInfo(ViewInfo viewInfo) {
+    this.viewInfo = viewInfo;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder("TableMeta{");
+    sb.append("id='").append(id).append('\'');
+    sb.append(", database='").append(database).append('\'');
+    sb.append(", table='").append(table).append('\'');
+    sb.append(", columns=").append(columns);
+    sb.append(", ddl='").append(ddl).append('\'');
+    sb.append(", partitionInfo=").append(partitionInfo);
+    sb.append(", detailedInfo=").append(detailedInfo);
+    sb.append(", storageInfo=").append(storageInfo);
+    sb.append(", viewInfo=").append(viewInfo);
+    sb.append('}');
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableResponse.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableResponse.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableResponse.java
new file mode 100644
index 0000000..09e1ea9
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/TableResponse.java
@@ -0,0 +1,62 @@
+/**
+ * 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.dto;
+
+/**
+ *
+ */
+public class TableResponse {
+  private String id;
+  private String name;
+  private String type;
+  private String databaseId;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public String getDatabaseId() {
+    return databaseId;
+  }
+
+  public void setDatabaseId(String databaseId) {
+    this.databaseId = databaseId;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ViewInfo.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ViewInfo.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ViewInfo.java
new file mode 100644
index 0000000..2e23014
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/dto/ViewInfo.java
@@ -0,0 +1,52 @@
+/**
+ * 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.dto;
+
+/**
+ *
+ */
+public class ViewInfo {
+  private String originalText;
+  private String extendedText;
+
+
+  public String getOriginalText() {
+    return originalText;
+  }
+
+  public void setOriginalText(String originalText) {
+    this.originalText = originalText;
+  }
+
+  public String getExtendedText() {
+    return extendedText;
+  }
+
+  public void setExtendedText(String extendedText) {
+    this.extendedText = extendedText;
+  }
+
+  @Override
+  public String toString() {
+    return "ViewInfo{" +
+        "originalText='" + originalText + '\'' +
+        ", extendedText='" + extendedText + '\'' +
+        '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/AbstractTableMetaParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/AbstractTableMetaParser.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/AbstractTableMetaParser.java
new file mode 100644
index 0000000..3c7ce99
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/AbstractTableMetaParser.java
@@ -0,0 +1,177 @@
+/**
+ * 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.Row;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ */
+public abstract class AbstractTableMetaParser<T> implements TableMetaSectionParser<T> {
+  private final String sectionMarker;
+  private final String secondarySectionMarker;
+  private final String sectionStartMarker;
+  private final String sectionEndMarker;
+
+
+  public AbstractTableMetaParser(String sectionMarker, String sectionStartMarker, String sectionEndMarker) {
+    this(sectionMarker, null, sectionStartMarker, sectionEndMarker);
+  }
+
+  public AbstractTableMetaParser(String sectionMarker, String secondarySectionMarker, String sectionStartMarker, String sectionEndMarker) {
+    this.sectionMarker = sectionMarker;
+    this.secondarySectionMarker = secondarySectionMarker;
+    this.sectionStartMarker = sectionStartMarker;
+    this.sectionEndMarker = sectionEndMarker;
+  }
+
+  protected Map<String, Object> parseSection(List<Row> rows) {
+    boolean sectionStarted = false;
+    boolean startMarkerAndEndMarkerIsSame = !(sectionStartMarker == null || sectionEndMarker == null) && sectionStartMarker.equalsIgnoreCase(sectionEndMarker);
+    boolean sectionDataReached = false;
+
+    Map<String, Object> result = new LinkedHashMap<>();
+
+    Iterator<Row> iterator = rows.iterator();
+
+    String currentNestedEntryParent = null;
+    List<Entry> currentNestedEntries = null;
+    boolean processingNestedEntry = false;
+
+    while (iterator.hasNext()) {
+      Row row = iterator.next();
+      String colName = ((String) row.getRow()[0]).trim();
+      String colValue = row.getRow()[1] != null ? ((String) row.getRow()[1]).trim() : null;
+      String colComment = row.getRow()[2] != null ? ((String) row.getRow()[2]).trim() : null;
+
+      if (sectionMarker.equalsIgnoreCase(colName)) {
+        sectionStarted = true;
+      } else {
+        if (sectionStarted) {
+          if (secondarySectionMarker != null && secondarySectionMarker.equalsIgnoreCase(colName) && colValue != null) {
+            continue;
+          }
+
+          if (sectionStartMarker != null && sectionStartMarker.equalsIgnoreCase(colName) && colValue == null) {
+            if (startMarkerAndEndMarkerIsSame) {
+              if (sectionDataReached) {
+                break;
+              }
+            }
+            sectionDataReached = true;
+            continue;
+          } else if (sectionEndMarker != null && sectionEndMarker.equalsIgnoreCase(colName) && colValue == null) {
+            break;
+          } else if (sectionStartMarker == null) {
+            sectionDataReached = true;
+            //continue;
+          }
+
+          if (colValue == null && !processingNestedEntry) {
+            currentNestedEntryParent = colName;
+            currentNestedEntries = new ArrayList<>();
+            processingNestedEntry = true;
+            continue;
+          } else if (colName.equalsIgnoreCase("") && processingNestedEntry) {
+            Entry entry = new Entry(colValue, colComment);
+            currentNestedEntries.add(entry);
+            continue;
+          } else if (processingNestedEntry) {
+            result.put(currentNestedEntryParent, currentNestedEntries);
+            processingNestedEntry = false;
+          }
+
+          Entry entry = new Entry(colName, colValue, colComment);
+          result.put(colName, entry);
+
+        }
+
+      }
+    }
+
+    if (processingNestedEntry) {
+      result.put(currentNestedEntryParent, currentNestedEntries);
+    }
+
+    return result;
+  }
+
+  protected Map<String, String> getMap(Map<String, Object> parsedSection, String key) {
+    Map<String, String> result = new HashMap<>();
+    Object value = parsedSection.get(key);
+    if(value == null) {
+      return null;
+    }
+    if (value instanceof List) {
+      List<Entry> entries = (List<Entry>)value;
+      for(Entry entry: entries) {
+        result.put(entry.getName(), entry.getValue());
+      }
+    }
+    return result;
+  }
+
+  protected String getString(Map<String, Object> parsedSection, String key) {
+    Object value = parsedSection.get(key);
+    if(value == null) {
+      return null;
+    }
+    if (value instanceof Entry) {
+      return ((Entry) parsedSection.get(key)).getValue();
+    }
+    return null;
+  }
+
+
+  public static class Entry {
+    private final String name;
+    private final String value;
+    private final String comment;
+
+    public Entry(String name, String type, String comment) {
+      this.name = name;
+      this.value = type;
+      this.comment = comment;
+    }
+
+    public Entry(String name, String type) {
+      this(name, type, null);
+    }
+
+    public String getName() {
+      return name;
+    }
+
+    public String getValue() {
+      return value;
+    }
+
+    public String getComment() {
+      return comment;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/ColumnInfoParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/ColumnInfoParser.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/ColumnInfoParser.java
new file mode 100644
index 0000000..893854f
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/ColumnInfoParser.java
@@ -0,0 +1,97 @@
+/**
+ * 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.Row;
+import org.apache.ambari.view.hive20.internal.dto.ColumnInfo;
+import org.apache.parquet.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Parses the columns from the output of 'describe formatted ${tableName}' output
+ */
+public class ColumnInfoParser extends AbstractTableMetaParser<List<ColumnInfo>> {
+  private static final Logger LOG = LoggerFactory.getLogger(ColumnInfoParser.class);
+
+  public ColumnInfoParser() {
+    super("# col_name", "", "");
+  }
+
+  @Override
+  public List<ColumnInfo> parse(List<Row> rows) {
+    List<ColumnInfo> columns = new ArrayList<>();
+    /* General Format: Starts from the first index itself
+     | # col_name                    | data_type                                                                     | comment                      |
+     |                               | NULL                                                                          | NULL                         |
+     | viewtime                      | int                                                                           |                              |
+     | userid                        | bigint                                                                        |                              |
+     | page_url                      | string                                                                        |                              |
+     | referrer_url                  | string                                                                        |                              |
+     | ip                            | string                                                                        | IP Address of the User       |
+     |                               | NULL                                                                          | NULL                         |
+     */
+
+    /*Iterator<Row> iterator = rows.iterator();
+    int index = 0;
+    // Skip first two rows
+    while (index < 2) {
+      iterator.next();
+      index++;
+    }
+
+    while (true) {
+      Row row = iterator.next();
+      // Columns section ends with a empty column name value
+      if (index >= rows.size() || "".equalsIgnoreCase((String) row.getRow()[0]))
+        break;
+
+      String colName = (String)row.getRow()[0];
+      String colType = (String)row.getRow()[1];
+      String colComment = (String)row.getRow()[2];
+
+      columns.add(new ColumnInfo(colName, colType, colComment));
+      index++;
+    }*/
+
+
+    Map<String, Object> parsedSection = parseSection(rows);
+    for(Object obj: parsedSection.values()) {
+      if(obj instanceof Entry) {
+        Entry entry = (Entry)obj;
+        String typeInfo = entry.getValue();
+        // parse precision and scale
+        List<String> typePrecisionScale = ParserUtils.parseColumnDataType(typeInfo);
+        String datatype = typePrecisionScale.get(0);
+        String precisionString = typePrecisionScale.get(1);
+        String scaleString = typePrecisionScale.get(2);
+        Integer precision = !Strings.isNullOrEmpty(precisionString) ? Integer.valueOf(precisionString.trim()): null;
+        Integer scale = !Strings.isNullOrEmpty(scaleString) ? Integer.valueOf(scaleString.trim()): null;
+        ColumnInfo columnInfo = new ColumnInfo(entry.getName(), datatype, precision, scale, entry.getComment());
+        columns.add(columnInfo);
+        LOG.debug("found column definition : {}", columnInfo);
+      }
+    }
+    return columns;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/CreateTableStatementParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/CreateTableStatementParser.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/CreateTableStatementParser.java
new file mode 100644
index 0000000..89c6ae1
--- /dev/null
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/internal/parsers/CreateTableStatementParser.java
@@ -0,0 +1,38 @@
+/**
+ * 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.Row;
+
+import java.util.List;
+
+/**
+ * Parses the rows and returns the create table statement
+ */
+public class CreateTableStatementParser implements TableMetaSectionParser<String> {
+  @Override
+  public String parse(List<Row> rows) {
+    StringBuilder builder = new StringBuilder();
+    for(Row row: rows) {
+      builder.append(row.getRow()[0]);
+      builder.append("\n");
+    }
+    return builder.toString();
+  }
+}