瀏覽代碼

HUE-5698 [editor] Lower the autocomplete weights for TABLESAMPLE and LATERAL VIEW

Johan Ahlen 8 年之前
父節點
當前提交
8092d226e9

+ 7 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_main.jison

@@ -1435,6 +1435,13 @@ TableExpression_EDIT
          keywords = keywords.concat(createWeightedKeywords($1.tableReferenceList.suggestKeywords, 3));
        }
 
+       // Lower the weights for 'TABLESAMPLE' and 'LATERAL VIEW'
+       keywords.forEach(function (keyword) {
+         if (keyword.value === 'TABLESAMPLE' || keyword.value === 'LATERAL VIEW') {
+           keyword.weight = 1.1;
+         }
+       });
+
        if (!$1.hasLateralViews && $1.tableReferenceList.types) {
          var veKeywords = getValueExpressionKeywords($1.tableReferenceList);
          keywords = keywords.concat(veKeywords.suggestKeywords);

+ 7 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sql.js

@@ -647,6 +647,13 @@ case 822:
          keywords = keywords.concat(createWeightedKeywords($$[$0-3].tableReferenceList.suggestKeywords, 3));
        }
 
+       // Lower the weights for 'TABLESAMPLE' and 'LATERAL VIEW'
+       keywords.forEach(function (keyword) {
+         if (keyword.value === 'TABLESAMPLE' || keyword.value === 'LATERAL VIEW') {
+           keyword.weight = 1.1;
+         }
+       });
+
        if (!$$[$0-3].hasLateralViews && $$[$0-3].tableReferenceList.types) {
          var veKeywords = getValueExpressionKeywords($$[$0-3].tableReferenceList);
          keywords = keywords.concat(veKeywords.suggestKeywords);