You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by pa...@apache.org on 2017/02/08 11:27:48 UTC
ambari git commit: AMBARI-19793. Hive2: Unreasonable response time
from query exeuction in hive view (pallavkul)
Repository: ambari
Updated Branches:
refs/heads/trunk 43f70c8d0 -> 8fd6395b3
AMBARI-19793. Hive2: Unreasonable response time from query exeuction in hive view (pallavkul)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8fd6395b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8fd6395b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8fd6395b
Branch: refs/heads/trunk
Commit: 8fd6395b3b6a95e17065a7c6ae26e8432c635a8c
Parents: 43f70c8
Author: pallavkul <pa...@gmail.com>
Authored: Wed Feb 8 16:56:49 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Wed Feb 8 16:56:49 2017 +0530
----------------------------------------------------------------------
.../resources/ui/app/routes/queries/query.js | 31 +-
.../src/main/resources/ui/app/routes/query.js | 305 -------------------
.../ui/app/templates/queries/query.hbs | 3 +-
.../main/resources/ui/app/templates/query.hbs | 84 -----
4 files changed, 4 insertions(+), 419 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fd6395b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
index b904e4e..dcf27b4 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
@@ -218,9 +218,8 @@ export default Ember.Route.extend({
self.get('controller.model').set('logFile', data.job.logFile);
self.get('controller').set('currentJobId', data.job.id);
- self.get('jobs').waitForJobToComplete(data.job.id, 5 * 1000, false)
+ self.get('jobs').waitForJobToComplete(data.job.id, 2 * 1000, false)
.then((status) => {
- Ember.run.later(() => {
self.get('controller').set('isJobSuccess', true);
self.send('getJob', data);
@@ -231,9 +230,6 @@ export default Ember.Route.extend({
//Last log
self.send('fetchLogs');
- //Open result tab and hide log tab
- //self.send('showQueryEditorResult');
- }, 2 * 1000);
}, (error) => {
Ember.run.later(() => {
// TODO: handle error
@@ -319,21 +315,6 @@ export default Ember.Route.extend({
}, function(reason) {
// on rejection
console.log('reason' , reason);
- if( reason.errors[0].status == 409 ){
- setTimeout(function(){
-
- //Put the code here for changing the log content.
- let logFile = self.get('controller.model').get('logFile');
- self.get('query').retrieveQueryLog(logFile).then(function(data) {
- self.get('controller.model').set('logResults', data.file.fileContent);
- }, function(error){
- console.log('error', error);
- });
-
-
- self.send('getJob',data);
- }, 2000);
- }
});
},
@@ -372,12 +353,6 @@ export default Ember.Route.extend({
}, function(reason) {
// on rejection
console.log('reason' , reason);
-
- if( reason.errors[0].status == 409 ){
- setTimeout(function(){
- self.send('getJob',data);
- }, 2000);
- }
});
} else { //Pages from cache object
this.get('controller.model').set('currentPage', currentPage+1);
@@ -533,8 +508,6 @@ export default Ember.Route.extend({
showQueryResultContainer(){
this.get('controller.model').set('isQueryResultContainer', true);
- },
-
-
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fd6395b/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
deleted file mode 100644
index 54213c7..0000000
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
+++ /dev/null
@@ -1,305 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-
-export default Ember.Route.extend({
-
- model() {
- return this.store.findAll('database');
- },
-
- query: Ember.inject.service(),
-
- afterModel(model) {
- if (model.get('length') > 0) {
- this.selectDatabase(model);
- }
- },
-
- setupController(controller, model) {
-
- let sortedModel = model.sortBy('name');
- let selectedModel = sortedModel.filterBy('selected', true).get('firstObject');
- sortedModel.removeObject(selectedModel);
- let finalList = [];
- let selectedDB = [];
-
- finalList.pushObject(selectedModel);
- finalList.pushObjects(sortedModel);
- controller.set('model', finalList);
-
- selectedDB.pushObject(selectedModel);
- controller.set('selectedModel',selectedDB);
-
- let selecteDBName = selectedModel.get('name');
-
- let self = this;
- let selectedTablesModels =[];
-
- selectedTablesModels.pushObject(
- {
- 'dbname': selecteDBName ,
- 'tables': this.store.query('table', {databaseId: selecteDBName})
- }
- )
-
- controller.set('selectedTablesModels',selectedTablesModels );
- controller.set('currentQuery', '');
- controller.set('isQueryRunning', false);
- controller.set('defaultQueryResult', {'schema' :[], 'rows' :[]});
- controller.set('queryResult', controller.get('defaultQueryResult'));
- controller.set('hidePreviousButton', true);
-
- //For Pagination
- localStorage.setItem("jobData", JSON.stringify([]));
- controller.set('prevPage', -1 );
- controller.set('currentPage', 0 );
- controller.set('nextPage', 1 );
- controller.set('currentJobData', null );
-
- },
-
- selectDatabase(model) {
- // check if default database is present
- let toSelect = model.findBy('name', 'default');
- if (Ember.isEmpty(toSelect)) {
- let sortedModel = model.sortBy('name');
- toSelect = sortedModel.get('firstObject');
- }
- toSelect.set('selected', true);
- },
-
- actions: {
-
- changeDbHandler(selectedDBs){
-
- let self = this;
- let selectedTablesModels =[];
-
- selectedDBs.forEach(function(db){
- selectedTablesModels.pushObject(
- {
- 'dbname': db ,
- 'tables':self.store.query('table', {databaseId: db})
- }
- )
- });
-
- this.get('controller').set('selectedTablesModels', selectedTablesModels );
-
- },
-
- tableSelected(){
- console.log('I am in tableSelected');
- },
-
- showTables(db){
- //should we do this by writing a seperate component.
- $('.collapse').hide();
- $('#' + db).toggle();
- },
-
- notEmptyDialogClosed() {
- this.get('controller').set('databaseNotEmpty', false);
- this.get('controller').set('databaseName', undefined);
- },
-
- executeQuery(isFirstCall){
-
- let self = this;
- let queryInput = this.get('controller').get('currentQuery');
- let dbid = this.get('controller').get('selectedTablesModels')[0]['dbname']
-
- self.get('controller').set('isQueryRunning', true);
- self.get('controller').set('queryResult', self.get('controller').get('defaultQueryResult'));
-
- let payload ={
- "title":"Worksheet",
- "hiveQueryId":null,
- "queryFile":null,
- "owner":null,
- "dataBase":dbid,
- "status":null,
- "statusMessage":null,
- "dateSubmitted":null,
- "forcedContent":queryInput,
- "logFile":null,
- "dagName":null,
- "dagId":null,
- "sessionTag":null,
- "statusDir":null,
- "referrer":"job",
- "confFile":null,
- "globalSettings":""};
-
-
- this.get('query').createJob(payload).then(function(data) {
- // applying a timeout otherwise it goes for status code 409, although that condition is also handled in the code.
- setTimeout(function(){
- self.get('controller').set('currentJobData', data);
- self.send('getJob', data);
- }, 2000);
- }, function(reason) {
- console.log(reason);
- });
-
- },
- getJob(data){
-
- var self = this;
- var data = data;
-
- let jobId = data.job.id;
- let dateSubmitted = data.job.dateSubmitted;
-
- this.get('query').getJob(jobId, dateSubmitted, true).then(function(data) {
- // on fulfillment
- console.log('getJob route', data );
- self.get('controller').set('queryResult', data);
- self.get('controller').set('isQueryRunning', false);
-
- let localArr = JSON.parse(localStorage.getItem("jobData"));
- localArr.push(data);
- localStorage.setItem("jobData", JSON.stringify(localArr));
-
- self.get('controller').set('currentPage', localArr.length);
- self.get('controller').set('prevPage', localArr.length-1);
-
-
- }, function(reason) {
- // on rejection
- console.log('reason' , reason);
-
- if( reason.errors[0].status == 409 ){
- setTimeout(function(){
- self.send('getJob',data);
- }, 2000);
- }
- });
-
- },
- goNextPage(){
-
- let nextPage = this.get('controller').get('nextPage');
- let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
-
- if(nextPage >= totalPages){
- var self = this;
- var data = this.get('controller').get('currentJobData');
-
- let jobId = data.job.id;
- let dateSubmitted = data.job.dateSubmitted;
-
-
- this.get('query').getJob(jobId, dateSubmitted, false).then(function(data) {
- // on fulfillment
- console.log('getJob route', data );
- self.get('controller').set('queryResult', data);
- self.get('controller').set('isQueryRunning', false);
- self.get('controller').set('hidePreviousButton', false);
-
- let localArr = JSON.parse(localStorage.getItem("jobData"));
- localArr.push(data);
-
-
- localStorage.setItem("jobData", JSON.stringify(localArr));
-
-
- self.get('controller').set('currentPage', localArr.length);
- self.get('controller').set('prevPage', localArr.length-1);
-
- self.get('controller').set('nextPage', localArr.length+1);
-
- }, function(reason) {
- // on rejection
- console.log('reason' , reason);
-
- if( reason.errors[0].status == 409 ){
- setTimeout(function(){
- self.send('getJob',data);
- }, 2000);
- }
- });
- } else {
-
- let currentPage = this.get('controller').get('currentPage');
- let prevPage = this.get('controller').get('prevPage');
- let nextPage = this.get('controller').get('nextPage');
- let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
-
- if(nextPage < totalPages ){
- this.get('controller').set('currentPage', currentPage+1 );
- this.get('controller').set('prevPage', prevPage + 1 );
- this.get('controller').set('nextPage', nextPage + 1);
-
- this.get('controller').set('hidePreviousButton', false);
-
- this.get('controller').set('queryResult', JSON.parse(localStorage.getItem("jobData"))[this.get('controller').get('currentPage')] );
- } else {
-
- console.log('upper limit exceed');
- this.send('goNextPage');
- }
- }
-
-
- },
- goPrevPage(){
-
- let currentPage = this.get('controller').get('currentPage');
- let prevPage = this.get('controller').get('prevPage');
- let nextPage = this.get('controller').get('nextPage');
- let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
-
- if(prevPage > -1){
- this.get('controller').set('currentPage', currentPage-1 );
- this.get('controller').set('prevPage', prevPage - 1 );
- this.get('controller').set('nextPage', this.get('controller').get('currentPage')+1);
-
- this.get('controller').set('queryResult', JSON.parse(localStorage.getItem("jobData"))[this.get('controller').get('currentPage')] );
- } else {
- //console.log('previous limit over');
- this.get('controller').set('hidePreviousButton', true);
- }
- },
-
- expandQueryEdidorPanel(){
- Ember.$('.query-editor-panel').toggleClass('query-editor-full-width');
- Ember.$('.database-panel').toggleClass("hide");
- },
-
- expandQueryResultPanel(){
-
- Ember.$('.query-editor-panel').toggleClass('query-editor-full-width');
- Ember.$('.query-editor-container').toggleClass("hide");
- Ember.$('.database-panel').toggleClass("hide");
- this.send('adjustPanelSize');
- },
-
- adjustPanelSize(){
- let isFullHeight = ($(window).height() ==(parseInt(Ember.$('.ember-light-table').css('height'), 10)) ) || false;
- if(!isFullHeight){
- Ember.$('.ember-light-table').css('height', '100vh');
- }else {
- Ember.$('.ember-light-table').css('height', '70vh');
- }
- }
-
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fd6395b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
index ce90883..8ee8e87 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
@@ -28,7 +28,8 @@
{{query-editor query=currentQuery }}
</div>
<div class="row query-editor-controls">
- <button class="btn btn-success" {{action "executeQuery" }}>{{fa-icon "check"}} Execute</button>
+ <button class="btn btn-success" {{action "executeQuery" }} disabled={{ worksheet.isQueryRunning}}>{{fa-icon "check"}} Execute</button>
+
<button class="btn btn-default" {{action "openWorksheetModal" }}>{{fa-icon "save"}} Save As</button>
<div class="btn-group">
<button class="btn btn-default" type="button" data-toggle="dropdown">Insert UDF
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fd6395b/contrib/views/hive20/src/main/resources/ui/app/templates/query.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/query.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/query.hbs
deleted file mode 100644
index 3575ec1..0000000
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/query.hbs
+++ /dev/null
@@ -1,84 +0,0 @@
-{{!
-* 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.
-}}
-
-{{multiple-database-search-bar databases=model selected=selected changeDbHandler="changeDbHandler" }}
-
-<div class="clearfix col-md-9 query-editor-panel">
- <div class="query-editor-container">
- <div class="row query-editor" style="position:relative">
- <span class="expand-button" {{action "expandQueryEdidorPanel" }} >
- {{fa-icon "expand"}}
- </span>
- {{query-editor query=currentQuery }}
- </div>
- <div class="row query-editor-controls">
- <button class="btn btn-success" {{action "executeQuery" }}>{{fa-icon "check"}} Execute</button>
- {{#if isQueryRunning}}
- <img src="http://www.bba-reman.com/images/fbloader.gif" height="22" width="32" />
- {{/if}}
- </div>
- </div>
- <div class="clearfix row query-editor-results" style="position: relative">
- {{query-result-table queryResult=queryResult hidePreviousButton=hidePreviousButton goNextPage='goNextPage' goPrevPage='goPrevPage' expandQueryResultPanel='expandQueryResultPanel' }}
- </div>
-</div>
-
-<div class="col-md-3 database-panel">
- <div class="database-container">
- <div class="row">
- <div class="panel-group database-panel" id="accordion" role="tablist" aria-multiselectable="true">
- {{#each selectedTablesModels as |tableModel|}}
- <div class="panel panel-default">
- <div class="panel-heading" role="tab">
- <h4 class="panel-title">
- <a role="button" data-toggle="collapse" data-parent="#accordion"
- href="javascript:void(0)" {{action 'showTables' tableModel.dbname }} aria-expanded="true"
- aria-controls={{tableModel.dbname}}>
- {{ tableModel.dbname }}
- </a>
- <small class="pull-right">Tables({{tableModel.tables.length}})</small>
- </h4>
- </div>
- <div id={{ tableModel.dbname }} class="panel-collapse collapse {{if singleDbModel 'in'}}" role="tabpanel"
- aria-labelledby="headingOne">
- <div class="panel-body">
- {{#if tableModel.tables.length }}
- {{#list-filter header="tables" items=tableModel.tables
- placeholder="Search Tables"
- as |filteredItems|}}
- {{#list-group class="table-list" items=filteredItems as |item|}}
- {{list-item item=item itemClicked="tableSelected"}}
- {{/list-group}}
- {{/list-filter}}
- {{else}}
- <div class="empty">No Table found.</div>
- {{/if}}
- </div>
- </div>
- </div>
- {{/each}}
- </div>
- </div>
-</div>
-</div>
-
-{{#if databaseNotEmpty}}
- {{database-not-empty name=databaseName close="notEmptyDialogClosed"}}
-{{/if}}
-
-{{outlet}}
\ No newline at end of file