فهرست منبع

HUE-8793 [autocomplete] Add support for quoted column and table aliases

Johan Ahlen 6 سال پیش
والد
کامیت
16ff40072e

+ 4 - 0
desktop/core/src/desktop/js/parse/jison/sql_main.jison

@@ -3721,12 +3721,16 @@ SimpleTable_EDIT
 OptionalCorrelationName
  :
  | RegularOrBacktickedIdentifier        -> { alias: $1, location: @1 }
+ | QuotedValue                          -> { alias: $1, location: @1 }
  | AnyAs RegularOrBacktickedIdentifier  -> { alias: $2, location: @2 }
+ | AnyAs QuotedValue                    -> { alias: $2, location: @2 }
  ;
 
 OptionalCorrelationName_EDIT
  : PartialBacktickedIdentifier
+ | QuotedValue_EDIT
  | AnyAs PartialBacktickedIdentifier
+ | AnyAs QuotedValue_EDIT
  | AnyAs 'CURSOR'
  ;
 

+ 13 - 0
desktop/core/src/desktop/js/parse/spec/sqlAutocompleteParser_Select_Spec.js

@@ -396,6 +396,19 @@ describe('sqlAutocompleteParser.js SELECT statements', () => {
       });
     });
 
+    it('should handle "SELECT a as \'a\', b "b", c as `c` from d \'d\', e as "e", f as `f`;"', () => {
+      assertAutoComplete({
+        beforeCursor: 'SELECT a as \'a\', b "b", c as `c` from d \'d\', e as "e", f as `f`; ',
+        afterCursor: '',
+        noErrors: true,
+        dialect: 'impala',
+        containsKeywords: ['SELECT'],
+        expectedResult: {
+          lowerCase: false
+        }
+      });
+    });
+
     it('should suggest columns "SELECT IF(baa, boo, bee) AS b, | FROM testTable;"', () => {
       assertAutoComplete({
         beforeCursor: 'SELECT IF(baa, boo, bee) AS b, ',

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
desktop/core/src/desktop/js/parse/sqlAutocompleteParser.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
desktop/core/src/desktop/js/parse/sqlSyntaxParser.js


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است