فهرست منبع

HUE-7311 [editor] Limit asterisk expansion to the tables in the select statement

Johan Ahlen 8 سال پیش
والد
کامیت
7ba84f6
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      desktop/core/src/desktop/static/desktop/js/autocomplete/sqlParseSupport.js

+ 8 - 4
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlParseSupport.js

@@ -507,7 +507,10 @@ var SqlParseSupport = (function () {
           if (tablePrimaries && tablePrimaries.length > 0) {
             location.tables = [];
             location.linked = false;
-            parser.expandIdentifierChain({ tablePrimaries: tablePrimaries, wrapper: location, anyOwner: true });
+            if (!location.identifierChain) {
+              location.identifierChain = [{ asterisk: true }];
+            }
+            parser.expandIdentifierChain({ tablePrimaries: tablePrimaries, wrapper: location, anyOwner: false });
             if (location.tables.length === 0) {
               parser.yy.locations.splice(i, 1);
             }
@@ -828,6 +831,10 @@ var SqlParseSupport = (function () {
         return;
       }
 
+      if (!anyOwner) {
+        tablePrimaries = filterTablePrimariesForOwner(tablePrimaries, wrapper.owner);
+      }
+
       if (identifierChain.length > 0 && identifierChain[identifierChain.length - 1].asterisk) {
         var tables = [];
         tablePrimaries.forEach(function (tablePrimary) {
@@ -857,9 +864,6 @@ var SqlParseSupport = (function () {
         }
       }
 
-      if (!anyOwner) {
-        tablePrimaries = filterTablePrimariesForOwner(tablePrimaries, wrapper.owner);
-      }
       // Impala can have references to maps or array, i.e. FROM table t, t.map m
       // We need to replace those in the identifierChain
       if (parser.isImpala()) {