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 2015/12/01 19:20:08 UTC

[18/50] ambari git commit: AMBARI-14010. Hive view doesn't show precision of types that support it. (Nitiraj Rathore via Jaimin)

AMBARI-14010. Hive view doesn't show precision of types that support it. (Nitiraj Rathore via Jaimin)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 85c751557746e224bd67ee153d005d31ea2d4b80
Parents: c1b5205
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Sun Nov 29 21:54:08 2015 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Sun Nov 29 21:54:08 2015 -0800

----------------------------------------------------------------------
 .../hive-web/app/helpers/format-column-type.js  | 39 ++++++++++++++++++++
 .../ui/hive-web/app/services/database.js        | 12 +++---
 .../hive-web/app/templates/databases-tree.hbs   |  2 +-
 3 files changed, 47 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/85c75155/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js
new file mode 100644
index 0000000..8566b5e
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+/**
+ used to format the precision and scale of type in database's table's columns
+**/
+
+import Ember from "ember";
+
+var columnTypeFormatter = function(column) {
+  let type = column.type;
+  let ext = type;
+  if( type === "VARCHAR" || type === "CHAR" || type == "DECIMAL"  ) {
+      ext += '(' + column.precision;
+    if (type == "DECIMAL") {
+        ext += "," + column.scale;
+    }
+    ext += ")";
+  }
+
+  return ext;
+};
+
+export default Ember.Handlebars.makeBoundHelper(columnTypeFormatter);

http://git-wip-us.apache.org/repos/asf/ambari/blob/85c75155/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
index 58789a3..97f5134 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
@@ -69,7 +69,7 @@ export default Ember.Service.extend({
               table.get('name');
 
     url += '.page?searchId&count=' + this.get('pageCount');
-    url += '&columns=3,5';
+    url += '&columns=3,5,6,8';
 
     if (searchTerm) {
       url += '&searchId=searchColumns' + '&like=' + searchTerm;
@@ -86,10 +86,12 @@ export default Ember.Service.extend({
         var columns;
 
         columns = data.rows.map(function (row) {
-          return Ember.Object.create({
-            name: row[0],
-            type: row[1]
-          });
+            return Ember.Object.create({
+              name: row[0],
+              type: row[1],
+              precision : row[2],
+              scale : row[3]
+            });
         });
 
         defer.resolve({

http://git-wip-us.apache.org/repos/asf/ambari/blob/85c75155/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
index 45a9b7f..f1fdbf7 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
@@ -28,7 +28,7 @@
                   {{#each column in table.visibleColumns}}
                     <div>
                       <strong>{{column.name}}</strong>
-                      <span class="pull-right">{{column.type}}</span>
+                      <span class="pull-right">{{format-column-type column}}</span>
                     </div>
                   {{/each}}
                   {{#if table.canGetNextPage}}