[notebook] Workaround lack of status flag in Impala profile page
@@ -1525,21 +1525,18 @@ var EditorViewModel = (function() {
});
};
- self.fetchResultSize = function(n) {
- if (typeof n === 'undefined') {
- n = 10;
- }
-
+ self.fetchResultSize = function(n, query_id) {
$.post("/notebook/api/fetch_result_size", {
notebook: ko.mapping.toJSON(notebook.getContext()),
snippet: ko.mapping.toJSON(self.getContext())
}, function (data) {
+ if (query_id == notebook.id()) { // If still on the same result
if (data.status == 0) {
if (data.result.rows != null) {
self.result.rows(data.result.rows);
} else if (self.type() == 'impala' && n > 0) {
setTimeout(function () {
- self.fetchResultSize(n - 1);
+ self.fetchResultSize(n - 1, query_id);
}, 1000);
}
} else if (data.status == 5) {
@@ -1547,6 +1544,7 @@ var EditorViewModel = (function() {
} else {
//$(document).trigger("error", data.message);
}
+ }
}).fail(function (xhr, textStatus, errorThrown) {
//$(document).trigger("error", xhr.responseText);
});
@@ -1578,7 +1576,10 @@ var EditorViewModel = (function() {
self.progress(100);
if (self.isSqlDialect()) {
if (self.result.handle().has_result_set) {
- self.fetchResultSize();
+ var _query_id = notebook.id();
+ setTimeout(function () { // Delay until we get IMPALA-5555
+ self.fetchResultSize(10, _query_id);
+ }, 2000);
} else { // Is DDL
if (self.lastExecutedStatement()) {
