ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-14010. Hive view doesn't show precision of types that support it. (Nitiraj Rathore via Jaimin)
Date Mon, 30 Nov 2015 05:56:09 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 97d6dd000 -> 193f42d51


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/193f42d5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/193f42d5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/193f42d5

Branch: refs/heads/branch-2.1
Commit: 193f42d5107fe44043cf938b11a745b8d83e4d53
Parents: 97d6dd0
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Sun Nov 29 21:54:08 2015 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Sun Nov 29 21:55:41 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/193f42d5/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/193f42d5/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/193f42d5/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}}


Mime
View raw message