AMBARI-19579. Hive View 2.0: Show precision and scale of a column in table manager view. (dipayanb)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fecf197c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fecf197c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fecf197c Branch: refs/heads/branch-dev-patch-upgrade Commit: fecf197c710dcd99cc2c8d1189e393fc227e5fb3 Parents: e83837e Author: Dipayan Bhowmick <[email protected]> Authored: Wed Jan 18 00:19:39 2017 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Wed Jan 18 00:20:12 2017 +0530 ---------------------------------------------------------------------- .../app/components/table-advanced-settings.js | 1 - .../ui/app/helpers/format-column-size.js | 39 ++++++++++++++++++++ .../databases/database/tables/table/columns.js | 10 +++++ .../ui/app/templates/components/column-item.hbs | 2 +- .../databases/database/tables/table/columns.hbs | 14 +++++-- .../database/tables/table/partitions.hbs | 2 +- 6 files changed, 61 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/components/table-advanced-settings.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/table-advanced-settings.js b/contrib/views/hive20/src/main/resources/ui/app/components/table-advanced-settings.js index 181816a..5e50a5c 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/components/table-advanced-settings.js +++ b/contrib/views/hive20/src/main/resources/ui/app/components/table-advanced-settings.js @@ -58,7 +58,6 @@ export default Ember.Component.extend({ } else { let defaultFileFormat = this.get('fileFormats').findBy('default', true); this.set('settings.fileFormat', {}); - debugger; this.set('settings.fileFormat.type', defaultFileFormat.name); } if (!Ember.isEmpty(this.get('settings.rowFormat'))) { http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/helpers/format-column-size.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/helpers/format-column-size.js b/contrib/views/hive20/src/main/resources/ui/app/helpers/format-column-size.js new file mode 100644 index 0000000..a24f797 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/helpers/format-column-size.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. + */ + +import Ember from 'ember'; + +export function formatColumnSize(params/*, hash*/) { + const precision = params[0]; + const scale = params[1]; + if (Ember.isEmpty(precision) && Ember.isEmpty(scale)) { + return ''; + } + let sizeString = '( '; + if (precision) { + sizeString = `${sizeString}${precision}` + } + if (scale) { + sizeString = `${sizeString}, ${scale}`; + } + sizeString = `${sizeString} )`; + + return sizeString; +} + +export default Ember.Helper.helper(formatColumnSize); http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js index a11a4de..694cf21 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js @@ -20,4 +20,14 @@ import TableMetaRouter from './table-meta-router'; export default TableMetaRouter.extend({ + setupController: function (controller, model) { + this._super(controller, model); + let table = controller.get('table'); + let clusteredColumns = table.get('storageInfo.bucketCols'); + let columns = table.get('columns'); + columns.forEach((column) => { + column.isClustered = !!clusteredColumns.contains(column.name); + }); + }, + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/templates/components/column-item.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/column-item.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/column-item.hbs index 96cf5ab..73fac89 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/column-item.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/column-item.hbs @@ -98,7 +98,7 @@ <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label> - {{input type="checkbox" checked=column.isClustered disabled=(not column.editing)}} Clustering + {{input type="checkbox" checked=column.isClustered disabled=(not column.editing)}} Clustered </label> </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/columns.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/columns.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/columns.hbs index f7f01f5..ef2ea21 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/columns.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/columns.hbs @@ -20,17 +20,23 @@ <table class="table table-bordered table-hover"> <thead> <tr> - <th>COLUMN NAME</th> - <th>COLUMN TYPE</th> - <th>COMMENT</th> + <th width="30%">COLUMN NAME</th> + <th width="20%">COLUMN TYPE</th> + <th width="40%">COMMENT</th> + <th width="10%">CLUSTERED</th> </tr> </thead> <tbody> {{#each table.columns as |column|}} <tr> <th>{{column.name}}</th> - <td>{{column.type}}</td> + <td>{{column.type}} {{format-column-size column.precision column.scale}}</td> <td>{{column.comment}}</td> + <td class="text-center"> + {{#if column.isClustered}} + <span class="text-primary">{{fa-icon "check"}}</span> + {{/if}} + </td> </tr> {{/each}} </tbody> http://git-wip-us.apache.org/repos/asf/ambari/blob/fecf197c/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/partitions.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/partitions.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/partitions.hbs index f66a0bc..2c4beb9 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/partitions.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table/partitions.hbs @@ -29,7 +29,7 @@ {{#each model.partitionInfo.columns as |column|}} <tr> <th>{{column.name}}</th> - <td>{{column.type}}</td> + <td>{{column.type}} {{format-column-size column.precision column.scale}}</td> <td>{{column.comment}}</td> </tr> {{/each}}
