Browse Source

PR-504 [autocomplete] Fixed a bug where autocompletion would break on subqueries (#504)

https://github.com/cloudera/hue/pull/504
Stefano Palazzo 8 years ago
parent
commit
a909f83
1 changed files with 2 additions and 2 deletions
  1. 2 2
      desktop/core/src/desktop/static/desktop/js/sqlAutocompleter3.js

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter3.js

@@ -1676,7 +1676,7 @@ var AutocompleteResults = (function () {
     // For Hive it could be either:
     // SELECT col.struct FROM db.tbl -or- SELECT col.struct FROM tbl
     if (self.snippet.type() === 'impala' || self.snippet.type() === 'hive') {
-      if (identifierChain.length > 1 && !identifierChain.subQuery) {
+      if (identifierChain.length > 1 && $.grep(identifierChain, function (e) { return e.subQuery; }).length == 0) {
         self.apiHelper.loadDatabases({
           sourceType: self.snippet.type(),
           timeout: AUTOCOMPLETE_TIMEOUT,
@@ -1731,4 +1731,4 @@ var SqlAutocompleter3 = (function () {
   };
 
   return SqlAutocompleter3;
-})();
+})();