Kaynağa Gözat

HUE-8367 [autocomplete] Various Impala autocomplete updates

- ALTER/CREATE/DROP/REFRESH privileges added to GRANT/REVOKE
- UDFs and SET options updated
- Optional column list and TABLESAMPLE clause added to COMPUTE STATS
- COMMENT added to CREATE VIEW
- SHOW CREATE VIEW added
Johan Ahlen 7 yıl önce
ebeveyn
işleme
c793cd85e7

+ 18 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_analyze.jison

@@ -197,7 +197,7 @@ InvalidateStatement_EDIT
  ;
  ;
 
 
 ComputeStatsStatement
 ComputeStatsStatement
- : '<impala>COMPUTE' '<impala>STATS' SchemaQualifiedTableIdentifier
+ : '<impala>COMPUTE' '<impala>STATS' SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalImpalaTableSample
    {
    {
      parser.addTablePrimary($3);
      parser.addTablePrimary($3);
    }
    }
@@ -223,6 +223,23 @@ ComputeStatsStatement_EDIT
      parser.addTablePrimary($3);
      parser.addTablePrimary($3);
      parser.suggestKeywords(['STATS', 'INCREMENTAL STATS']);
      parser.suggestKeywords(['STATS', 'INCREMENTAL STATS']);
    }
    }
+ | '<impala>COMPUTE' '<impala>STATS' SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalImpalaTableSample 'CURSOR'
+   {
+     parser.addTablePrimary($3);
+     if (!$5) {
+       parser.suggestKeywords(['TABLESAMPLE']);
+     } else if ($5.suggestKeywords) {
+       parser.suggestKeywords($5.suggestKeywords);
+     }
+   }
+ | '<impala>COMPUTE' '<impala>STATS' SchemaQualifiedTableIdentifier ParenthesizedColumnList_EDIT OptionalImpalaTableSample
+   {
+     parser.addTablePrimary($3);
+   }
+ | '<impala>COMPUTE' '<impala>STATS' SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalImpalaTableSample_EDIT
+   {
+     parser.addTablePrimary($3);
+   }
  | '<impala>COMPUTE' 'CURSOR' '<impala>STATS' SchemaQualifiedTableIdentifier OptionalPartitionSpec
  | '<impala>COMPUTE' 'CURSOR' '<impala>STATS' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
    {
      parser.addTablePrimary($4);
      parser.addTablePrimary($4);

+ 26 - 6
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_create.jison

@@ -1306,15 +1306,19 @@ ViewDefinition_EDIT
      }
      }
    }
    }
  | AnyCreate AnyView OptionalIfNotExists_EDIT
  | AnyCreate AnyView OptionalIfNotExists_EDIT
+ | AnyCreate AnyView OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment OptionalHiveTblproperties
  | AnyCreate AnyView OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment OptionalHiveTblproperties 'CURSOR'
  | AnyCreate AnyView OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment OptionalHiveTblproperties 'CURSOR'
    {
    {
-     if (parser.isHive() && !$6 && !$7) {
-       parser.suggestKeywords([{ value: 'COMMENT', weight: 3 }, { value: 'TBLPROPERTIES', weight: 2 }, {value: 'AS', weight: 1 }]);
-     } else if (parser.isHive() && !$7) {
-       parser.suggestKeywords([{ value: 'TBLPROPERTIES', weight: 2 }, {value: 'AS', weight: 1 }]);
-     } else {
-       parser.suggestKeywords([{value: 'AS', weight: 1 }]);
+     var keywords = [{value: 'AS', weight: 1 }];
+     if (!$7) {
+       if (parser.isHive()) {
+         keywords.push({ value: 'TBLPROPERTIES', weight: 2 });
+       }
+       if (!$6) {
+         keywords.push({ value: 'COMMENT', weight: 3 });
+       }
      }
      }
+     parser.suggestKeywords(keywords);
    }
    }
  | AnyCreate AnyView OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment OptionalHiveTblproperties AnyAs 'CURSOR'
  | AnyCreate AnyView OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment OptionalHiveTblproperties AnyAs 'CURSOR'
    {
    {
@@ -1683,11 +1687,27 @@ ParenthesizedViewColumnList
  : '(' ViewColumnList ')'
  : '(' ViewColumnList ')'
  ;
  ;
 
 
+ParenthesizedViewColumnList_EDIT
+ : '(' ViewColumnList_EDIT RightParenthesisOrError
+   {
+     if (!$2) {
+       parser.suggestKeywords(['COMMENT']);
+     }
+   }
+ ;
+
 ViewColumnList
 ViewColumnList
  : ColumnReference OptionalComment
  : ColumnReference OptionalComment
  | ViewColumnList ',' ColumnReference OptionalComment
  | ViewColumnList ',' ColumnReference OptionalComment
  ;
  ;
 
 
+ViewColumnList_EDIT
+ : ColumnReference OptionalComment 'CURSOR'                                        --> $2
+ | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     --> $2
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     --> $4
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  --> $4
+ ;
+
 RoleDefinition
 RoleDefinition
  : AnyCreate AnyRole RegularIdentifier
  : AnyCreate AnyRole RegularIdentifier
  ;
  ;

+ 28 - 8
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_grant.jison

@@ -90,7 +90,7 @@ GrantStatement_EDIT
  | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
  | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
  | '<impala>GRANT' 'CURSOR'
  | '<impala>GRANT' 'CURSOR'
    {
    {
-     parser.suggestKeywords(['ALL', 'INSERT', 'ROLE', 'SELECT']);
+     parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']);
    }
    }
  | '<impala>GRANT' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
  | '<impala>GRANT' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
    {
    {
@@ -103,11 +103,19 @@ GrantStatement_EDIT
  | '<impala>GRANT' ImpalaPrivilegeType_EDIT
  | '<impala>GRANT' ImpalaPrivilegeType_EDIT
  | '<impala>GRANT' ImpalaPrivilegeType 'CURSOR'
  | '<impala>GRANT' ImpalaPrivilegeType 'CURSOR'
    {
    {
-     parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
+     if ($2.isCreate) {
+       parser.suggestKeywords(['ON DATABASE', 'ON SERVER']);
+     } else {
+       parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
+     }
    }
    }
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' 'CURSOR'
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' 'CURSOR'
    {
    {
-     parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
+     if ($2.isCreate) {
+        parser.suggestKeywords(['DATABASE', 'SERVER']);
+     } else {
+        parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
+     }
    }
    }
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'
  | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'
@@ -250,9 +258,13 @@ HivePrivilegeType
  ;
  ;
 
 
 ImpalaPrivilegeType
 ImpalaPrivilegeType
- : '<impala>INSERT'
+ : 'ALL'
+ | 'ALTER'
+ | '<impala>CREATE'  --> { isCreate: true }
+ | 'DROP'
+ | '<impala>INSERT'
+ | '<impala>REFRESH'
  | 'SELECT' OptionalParenthesizedColumnList
  | 'SELECT' OptionalParenthesizedColumnList
- | 'ALL'
  ;
  ;
 
 
 ImpalaPrivilegeType_EDIT
 ImpalaPrivilegeType_EDIT
@@ -453,7 +465,7 @@ RevokeStatement_EDIT
    }
    }
  | '<impala>REVOKE' 'CURSOR'
  | '<impala>REVOKE' 'CURSOR'
    {
    {
-     parser.suggestKeywords(['ALL', 'INSERT', 'ROLE', 'SELECT']);
+     parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']);
    }
    }
  | '<impala>REVOKE' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
  | '<impala>REVOKE' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
    {
    {
@@ -466,11 +478,19 @@ RevokeStatement_EDIT
  | '<impala>REVOKE' ImpalaPrivilegeType_EDIT
  | '<impala>REVOKE' ImpalaPrivilegeType_EDIT
  | '<impala>REVOKE' ImpalaPrivilegeType 'CURSOR'
  | '<impala>REVOKE' ImpalaPrivilegeType 'CURSOR'
    {
    {
-     parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
+     if ($2.isCreate) {
+       parser.suggestKeywords(['ON DATABASE', 'ON SERVER']);
+     } else {
+       parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
+     }
    }
    }
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' 'CURSOR'
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' 'CURSOR'
    {
    {
-     parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
+     if ($2.isCreate) {
+       parser.suggestKeywords(['DATABASE', 'SERVER']);
+     } else {
+       parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
+     }
    }
    }
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'
  | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'

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

@@ -3062,7 +3062,7 @@ OptionalHiveTableSample_EDIT
 
 
 OptionalImpalaTableSample
 OptionalImpalaTableSample
  :
  :
- | '<impala>TABLESAMPLE' '<impala>SYSTEM' '(' 'UNSIGNED_INTEGER' ')'                                                  --> { suggestKeywords: ['REPEATABLE'] }
+ | '<impala>TABLESAMPLE' '<impala>SYSTEM' '(' 'UNSIGNED_INTEGER' ')'                                                  --> { suggestKeywords: ['REPEATABLE()'] }
  | '<impala>TABLESAMPLE' '<impala>SYSTEM' '(' 'UNSIGNED_INTEGER' ')' '<impala>REPEATABLE' '(' 'UNSIGNED_INTEGER' ')'
  | '<impala>TABLESAMPLE' '<impala>SYSTEM' '(' 'UNSIGNED_INTEGER' ')' '<impala>REPEATABLE' '(' 'UNSIGNED_INTEGER' ')'
  ;
  ;
 
 

+ 28 - 6
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_show.jison

@@ -171,7 +171,7 @@ ShowConfStatement
  ;
  ;
 
 
 ShowCreateTableStatement
 ShowCreateTableStatement
- : AnyShow HiveOrImpalaCreate AnyTable RegularOrBackTickedSchemaQualifiedName
+ : AnyShow HiveOrImpalaCreate AnyTableOrView RegularOrBackTickedSchemaQualifiedName
    {
    {
      parser.addTablePrimary($4);
      parser.addTablePrimary($4);
    }
    }
@@ -180,23 +180,45 @@ ShowCreateTableStatement
 ShowCreateTableStatement_EDIT
 ShowCreateTableStatement_EDIT
  : AnyShow HiveOrImpalaCreate 'CURSOR'
  : AnyShow HiveOrImpalaCreate 'CURSOR'
    {
    {
-     parser.suggestKeywords(['TABLE']);
+     if (parser.isImpala()) {
+       parser.suggestKeywords(['TABLE', 'VIEW']);
+     } else {
+       parser.suggestKeywords(['TABLE']);
+     }
    }
    }
- | AnyShow HiveOrImpalaCreate AnyTable 'CURSOR'
+ | AnyShow HiveOrImpalaCreate AnyTableOrView 'CURSOR'
    {
    {
-     parser.suggestTables();
+     if ($3.isView && parser.isImpala()) {
+       parser.suggestTables({ onlyViews: true });
+     } else {
+       parser.suggestTables();
+     }
      parser.suggestDatabases({
      parser.suggestDatabases({
        appendDot: true
        appendDot: true
      });
      });
    }
    }
- | AnyShow HiveOrImpalaCreate AnyTable RegularOrBackTickedSchemaQualifiedName_EDIT
+ | AnyShow HiveOrImpalaCreate AnyTableOrView RegularOrBackTickedSchemaQualifiedName_EDIT
+   {
+     if (parser.yy.result.suggestTables && $3.isView) {
+       parser.yy.result.suggestTables.onlyViews = true;
+     }
+   }
  | AnyShow HiveOrImpalaCreate 'CURSOR' RegularOrBackTickedSchemaQualifiedName
  | AnyShow HiveOrImpalaCreate 'CURSOR' RegularOrBackTickedSchemaQualifiedName
    {
    {
      parser.addTablePrimary($4);
      parser.addTablePrimary($4);
-     parser.suggestKeywords(['TABLE']);
+     if (parser.isImpala()) {
+       parser.suggestKeywords(['TABLE', 'VIEW']);
+     } else {
+       parser.suggestKeywords(['TABLE']);
+     }
    }
    }
  ;
  ;
 
 
+AnyTableOrView
+ : AnyTable
+ | 'VIEW'   --> { isView: true }
+ ;
+
 ShowCurrentRolesStatement
 ShowCurrentRolesStatement
  : AnyShow '<hive>CURRENT' '<hive>ROLES'
  : AnyShow '<hive>CURRENT' '<hive>ROLES'
  | AnyShow '<impala>CURRENT' '<impala>ROLES'
  | AnyShow '<impala>CURRENT' '<impala>ROLES'

+ 64 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecAnalyze.js

@@ -277,6 +277,19 @@
         });
         });
       });
       });
 
 
+      it('should handle "COMPUTE STATS bla.boo (foo, bar) TABLESAMPLE SYSTEM(10) REPEATABLE(10);|"', function() {
+        assertAutoComplete({
+          beforeCursor: 'COMPUTE STATS bla.boo (foo, bar) TABLESAMPLE SYSTEM(10) REPEATABLE(10);',
+          afterCursor: '',
+          dialect: 'impala',
+          noErrors: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
       it('should handle "COMPUTE INCREMENTAL STATS bla.boo;|"', function() {
       it('should handle "COMPUTE INCREMENTAL STATS bla.boo;|"', function() {
         assertAutoComplete({
         assertAutoComplete({
           beforeCursor: 'COMPUTE INCREMENTAL STATS bla.boo;',
           beforeCursor: 'COMPUTE INCREMENTAL STATS bla.boo;',
@@ -382,6 +395,57 @@
         });
         });
       });
       });
 
 
+      it('should suggest keywords for "COMPUTE STATS tbl |"', function() {
+        assertAutoComplete({
+          beforeCursor: 'COMPUTE STATS tbl ',
+          afterCursor: '',
+          dialect: 'impala',
+          noErrors:true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['TABLESAMPLE']
+          }
+        });
+      });
+
+      it('should suggest columns for "COMPUTE STATS db.tbl (|"', function() {
+        assertAutoComplete({
+          beforeCursor: 'COMPUTE STATS db.tbl (',
+          afterCursor: '',
+          dialect: 'impala',
+          expectedResult: {
+            lowerCase: false,
+            suggestColumns: { tables: [{ identifierChain: [{ name: 'db'}, { name: 'tbl'} ]}]}
+          }
+        });
+      });
+
+      it('should suggest keywords for "COMPUTE STATS tbl TABLESAMPLE |"', function() {
+        assertAutoComplete({
+          beforeCursor: 'COMPUTE STATS tbl TABLESAMPLE ',
+          afterCursor: '',
+          dialect: 'impala',
+          noErrors:true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['SYSTEM()']
+          }
+        });
+      });
+
+      it('should suggest keywords for "COMPUTE STATS tbl TABLESAMPLE SYSTEM(1) |"', function() {
+        assertAutoComplete({
+          beforeCursor: 'COMPUTE STATS tbl TABLESAMPLE SYSTEM(1) ',
+          afterCursor: '',
+          dialect: 'impala',
+          noErrors:true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['REPEATABLE()']
+          }
+        });
+      });
+
       it('should suggest tables for "COMPUTE STATS db.|"', function() {
       it('should suggest tables for "COMPUTE STATS db.|"', function() {
         assertAutoComplete({
         assertAutoComplete({
           beforeCursor: 'COMPUTE STATS db.',
           beforeCursor: 'COMPUTE STATS db.',

+ 36 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecCreate.js

@@ -3062,6 +3062,42 @@
             beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
             beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
             afterCursor: '',
             afterCursor: '',
             dialect: 'impala',
             dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['COMMENT', 'AS']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE VIEW boo (id |"', function () {
+          assertAutoComplete({
+            dialect: 'impala',
+            beforeCursor: 'CREATE VIEW boo (id ',
+            afterCursor: '',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['COMMENT']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE VIEW boo (id COMMENT \'boo\') |"', function () {
+          assertAutoComplete({
+            dialect: 'impala',
+            beforeCursor: 'CREATE VIEW boo (id COMMENT \'boo\') ',
+            afterCursor: '',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['COMMENT', 'AS']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE VIEW boo (id COMMENT \'boo\') COMMENT \'foo\' |"', function () {
+          assertAutoComplete({
+            dialect: 'impala',
+            beforeCursor: 'CREATE VIEW boo (id COMMENT \'boo\') COMMENT \'foo\' ',
+            afterCursor: '',
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
               suggestKeywords: ['AS']
               suggestKeywords: ['AS']

+ 54 - 2
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecGrant.js

@@ -406,7 +406,33 @@
             dialect: 'impala',
             dialect: 'impala',
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['ALL', 'INSERT', 'ROLE', 'SELECT']
+              suggestKeywords: ['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']
+            }
+          });
+        });
+
+        it('should suggest keywords for "GRANT ALTER ON SERVER svr TO |"', function() {
+          assertAutoComplete({
+            beforeCursor: 'GRANT ALTER ON SERVER svr TO ',
+            afterCursor: '',
+            noErrors: true,
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['ROLE']
+            }
+          });
+        });
+
+        it('should suggest keywords for "GRANT DROP ON SERVER svr |"', function() {
+          assertAutoComplete({
+            beforeCursor: 'GRANT DROP ON SERVER svr ',
+            afterCursor: '',
+            noErrors: true,
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['TO']
             }
             }
           });
           });
         });
         });
@@ -988,7 +1014,33 @@
             noErrors: true,
             noErrors: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['ALL', 'INSERT', 'ROLE', 'SELECT']
+              suggestKeywords: ['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']
+            }
+          });
+        });
+
+        it('should suggest keywords for "REVOKE CREATE |"', function() {
+          assertAutoComplete({
+            beforeCursor: 'REVOKE CREATE ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['ON DATABASE', 'ON SERVER']
+            }
+          });
+        });
+
+        it('should suggest keywords for "REVOKE REFRESH |"', function() {
+          assertAutoComplete({
+            beforeCursor: 'REVOKE REFRESH ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']
             }
             }
           });
           });
         });
         });

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecSelect.js

@@ -5987,7 +5987,7 @@
             dialect: 'impala',
             dialect: 'impala',
             noErrors: true,
             noErrors: true,
             containsKeywords: ['TABLESAMPLE', 'AS'],
             containsKeywords: ['TABLESAMPLE', 'AS'],
-            doesNotContainKeywords: ['REPEATABLE'],
+            doesNotContainKeywords: ['REPEATABLE()'],
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
               suggestJoins: {prependJoin: true, tables: [{identifierChain: [{name: 'boo'}]}]},
               suggestJoins: {prependJoin: true, tables: [{identifierChain: [{name: 'boo'}]}]},
@@ -6022,7 +6022,7 @@
             afterCursor: '',
             afterCursor: '',
             dialect: 'impala',
             dialect: 'impala',
             noErrors: true,
             noErrors: true,
-            containsKeywords: ['REPEATABLE'],
+            containsKeywords: ['REPEATABLE()'],
             doesNotContainKeywords: ['TABLESAMPLE'],
             doesNotContainKeywords: ['TABLESAMPLE'],
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,

+ 28 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecShow.js

@@ -1335,7 +1335,7 @@
           dialect: 'impala',
           dialect: 'impala',
           expectedResult: {
           expectedResult: {
             lowerCase: false,
             lowerCase: false,
-            suggestKeywords: ['TABLE']
+            suggestKeywords: ['TABLE', 'VIEW']
           }
           }
         });
         });
       });
       });
@@ -1355,6 +1355,33 @@
         });
         });
       });
       });
 
 
+      it('should suggest views for "SHOW CREATE VIEW |"', function() {
+        assertAutoComplete({
+          beforeCursor: 'SHOW CREATE VIEW ',
+          afterCursor: '',
+          dialect: 'impala',
+          expectedResult: {
+            lowerCase: false,
+            suggestTables: { onlyViews: true },
+            suggestDatabases: {
+              appendDot: true
+            }
+          }
+        });
+      });
+
+      it('should suggest views for "SHOW CREATE VIEW db.|"', function() {
+        assertAutoComplete({
+          beforeCursor: 'SHOW CREATE VIEW db.',
+          afterCursor: '',
+          dialect: 'impala',
+          expectedResult: {
+            lowerCase: false,
+            suggestTables: { onlyViews: true, identifierChain: [{ name: 'db'}] },
+          }
+        });
+      });
+
       it('should suggest tables for "SHOW CREATE TABLE partial|"', function() {
       it('should suggest tables for "SHOW CREATE TABLE partial|"', function() {
         assertAutoComplete({
         assertAutoComplete({
           beforeCursor: 'SHOW CREATE TABLE partial',
           beforeCursor: 'SHOW CREATE TABLE partial',

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlAutocompleteParser.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlSyntaxParser.js


+ 22 - 0
desktop/core/src/desktop/static/desktop/js/sqlFunctions.js

@@ -162,6 +162,11 @@ var SqlSetOptions = (function () {
         type: 'String; SNAPPY, GZIP or NONE',
         type: 'String; SNAPPY, GZIP or NONE',
         default: 'SNAPPY'
         default: 'SNAPPY'
       },
       },
+      'COMPUTE_STATS_MIN_SAMPLE_SIZE': {
+        description: 'The COMPUTE_STATS_MIN_SAMPLE_SIZE query option specifies the minimum number of bytes that will be scanned in COMPUTE STATS TABLESAMPLE, regardless of the user-supplied sampling percent. This query option prevents sampling for very small tables where accurate stats can be obtained cheaply without sampling because the minimum sample size is required to get meaningful stats.',
+        type: 'Integer',
+        default: '1073741824 (1GB)'
+      },
       'DEFAULT_JOIN_DISTRIBUTION_MODE': {
       'DEFAULT_JOIN_DISTRIBUTION_MODE': {
         description: 'This option determines the join distribution that Impala uses when any of the tables involved in a join query is missing statistics.\n\nThe setting DEFAULT_JOIN_DISTRIBUTION_MODE=SHUFFLE is recommended when setting up and deploying new clusters, because it is less likely to result in serious consequences such as spilling or out-of-memory errors if the query plan is based on incomplete information.',
         description: 'This option determines the join distribution that Impala uses when any of the tables involved in a join query is missing statistics.\n\nThe setting DEFAULT_JOIN_DISTRIBUTION_MODE=SHUFFLE is recommended when setting up and deploying new clusters, because it is less likely to result in serious consequences such as spilling or out-of-memory errors if the query plan is based on incomplete information.',
         type: 'Integer; The allowed values are BROADCAST (equivalent to 0) or SHUFFLE (equivalent to 1).',
         type: 'Integer; The allowed values are BROADCAST (equivalent to 0) or SHUFFLE (equivalent to 1).',
@@ -197,6 +202,11 @@ var SqlSetOptions = (function () {
         type: 'Numeric',
         type: 'Numeric',
         default: '100'
         default: '100'
       },
       },
+      'EXEC_TIME_LIMIT_S': {
+        description: 'The EXEC_TIME_LIMIT_S query option sets a time limit on query execution. If a query is still executing when time limit expires, it is automatically canceled. The option is intended to prevent runaway queries that execute for much longer than intended.',
+        type: 'Numeric',
+        default: '0 (no time limit)'
+      },
       'EXPLAIN_LEVEL': {
       'EXPLAIN_LEVEL': {
         description: 'Controls the amount of detail provided in the output of the EXPLAIN statement. The basic output can help you identify high-level performance issues such as scanning a higher volume of data or more partitions than you expect. The higher levels of detail show how intermediate results flow between nodes and how different SQL operations such as ORDER BY, GROUP BY, joins, and WHERE clauses are implemented within a distributed query.',
         description: 'Controls the amount of detail provided in the output of the EXPLAIN statement. The basic output can help you identify high-level performance issues such as scanning a higher volume of data or more partitions than you expect. The higher levels of detail show how intermediate results flow between nodes and how different SQL operations such as ORDER BY, GROUP BY, joins, and WHERE clauses are implemented within a distributed query.',
         type: 'String or Int; 0 - MINIMAL, 1 - STANDARD, 2 - EXTENDED or 3 - VERBOSE',
         type: 'String or Int; 0 - MINIMAL, 1 - STANDARD, 2 - EXTENDED or 3 - VERBOSE',
@@ -337,6 +347,11 @@ var SqlSetOptions = (function () {
         type: 'Numeric, with optional unit specifier',
         type: 'Numeric, with optional unit specifier',
         default: '-1 (amount of spill space is unlimited)'
         default: '-1 (amount of spill space is unlimited)'
       },
       },
+      'SHUFFLE_DISTINCT_EXPRS': {
+        description: 'The SHUFFLE_DISTINCT_EXPRS query option controls the shuffling behavior when a query has both grouping and distinct expressions. Impala can optionally include the distinct expressions in the hash exchange to spread the data among more nodes. However, this plan requires one more hash exchange phase. It is recommended that you turn off this option if the NDVs of the grouping expressions are high.',
+        type: 'Boolean; recognized values are 1 and 0, or true and false; any other value interpreted as false',
+        default: 'false (shown as 0 in output of SET statement)'
+      },
       'SYNC_DDL': {
       'SYNC_DDL': {
         description: 'When enabled, causes any DDL operation such as CREATE TABLE or ALTER TABLE to return only when the changes have been propagated to all other Impala nodes in the cluster by the Impala catalog service. That way, if you issue a subsequent CONNECT statement in impala-shell to connect to a different node in the cluster, you can be sure that other node will already recognize any added or changed tables. (The catalog service automatically broadcasts the DDL changes to all nodes automatically, but without this option there could be a period of inconsistency if you quickly switched to another node, such as by issuing a subsequent query through a load-balancing proxy.)',
         description: 'When enabled, causes any DDL operation such as CREATE TABLE or ALTER TABLE to return only when the changes have been propagated to all other Impala nodes in the cluster by the Impala catalog service. That way, if you issue a subsequent CONNECT statement in impala-shell to connect to a different node in the cluster, you can be sure that other node will already recognize any added or changed tables. (The catalog service automatically broadcasts the DDL changes to all nodes automatically, but without this option there could be a period of inconsistency if you quickly switched to another node, such as by issuing a subsequent query through a load-balancing proxy.)',
         type: 'Boolean; recognized values are 1 and 0, or true and false; any other value interpreted as false',
         type: 'Boolean; recognized values are 1 and 0, or true and false; any other value interpreted as false',
@@ -2853,6 +2868,13 @@ var SqlFunctions = (function () {
 				draggable: 'parse_url()',
 				draggable: 'parse_url()',
         description: 'Returns the portion of a URL corresponding to a specified part. The part argument can be \'PROTOCOL\', \'HOST\', \'PATH\', \'REF\', \'AUTHORITY\', \'FILE\', \'USERINFO\', or \'QUERY\'. Uppercase is required for these literal values. When requesting the QUERY portion of the URL, you can optionally specify a key to retrieve just the associated value from the key-value pairs in the query string.'
         description: 'Returns the portion of a URL corresponding to a specified part. The part argument can be \'PROTOCOL\', \'HOST\', \'PATH\', \'REF\', \'AUTHORITY\', \'FILE\', \'USERINFO\', or \'QUERY\'. Uppercase is required for these literal values. When requesting the QUERY portion of the URL, you can optionally specify a key to retrieve just the associated value from the key-value pairs in the query string.'
       },
       },
+      regexp_escape: {
+        returnTypes: ['STRING'],
+        arguments: [[{type: 'STRING'}]],
+        signature: 'regexp_escape(STRING source)',
+        draggable: 'regexp_escape()',
+        description: 'The regexp_escape function returns a string escaped for the special character in RE2 library so that the special characters are interpreted literally rather than as special characters. The following special characters are escaped by the function: .\\+*?[^]$(){}=!<>|:-'
+      },
       regexp_extract: {
       regexp_extract: {
         returnTypes: ['STRING'],
         returnTypes: ['STRING'],
         arguments: [[{type: 'STRING'}], [{type: 'STRING'}], [{type: 'INT'}]],
         arguments: [[{type: 'STRING'}], [{type: 'STRING'}], [{type: 'INT'}]],

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor