Browse Source

HUE-6958 [autocomplete] Add the DOUBLE PRECISION data type to Hive

Johan Ahlen 8 years ago
parent
commit
9391d4f4c0

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/ace/mode-hive.js


+ 1 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql.jisonlex

@@ -97,6 +97,7 @@
 <hive>'DIRECTORY'                          { this.begin('hdfs'); return '<hive>DIRECTORY'; }
 <hive>'DIRECTORY'                          { this.begin('hdfs'); return '<hive>DIRECTORY'; }
 <hive>'DISABLE'                            { return '<hive>DISABLE'; }
 <hive>'DISABLE'                            { return '<hive>DISABLE'; }
 <hive>'DISTRIBUTE'                         { return '<hive>DISTRIBUTE'; }
 <hive>'DISTRIBUTE'                         { return '<hive>DISTRIBUTE'; }
+<hive>DOUBLE\s+PRECISION                   { return '<hive>DOUBLE_PRECISION'; }
 <hive>'ESCAPED'                            { return '<hive>ESCAPED'; }
 <hive>'ESCAPED'                            { return '<hive>ESCAPED'; }
 <hive>'ENABLE'                             { return '<hive>ENABLE'; }
 <hive>'ENABLE'                             { return '<hive>ENABLE'; }
 <hive>'EXCHANGE'                           { return '<hive>EXCHANGE'; }
 <hive>'EXCHANGE'                           { return '<hive>EXCHANGE'; }

+ 3 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_create.jison

@@ -358,6 +358,9 @@ ColumnSpecification
      }
      }
      if (!$3['comment']) {
      if (!$3['comment']) {
        keywords.push('COMMENT');
        keywords.push('COMMENT');
+       if (parser.isHive() && $2.toLowerCase() === 'double') {
+         keywords.push({ value: 'PRECISION', weight: 2 });
+       }
      }
      }
      if (keywords.length > 0) {
      if (keywords.length > 0) {
        $$ = { suggestKeywords: keywords };
        $$ = { suggestKeywords: keywords };

File diff suppressed because it is too large
+ 1 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_main.jison


+ 15 - 3
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecCreate.js

@@ -2434,16 +2434,28 @@
             beforeCursor: 'CREATE TABLE foo (id ',
             beforeCursor: 'CREATE TABLE foo (id ',
             afterCursor: '',
             afterCursor: '',
             dialect: 'hive',
             dialect: 'hive',
-            containsKeywords: ['BIGINT', 'MAP<>'],
+            containsKeywords: ['BIGINT', 'MAP<>', 'DOUBLE PRECISION'],
             expectedResult: {
             expectedResult: {
               lowerCase: false
               lowerCase: false
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest keywords for "CREATE TABLE foo(id |"', function () {
+        it('should suggest keywords for "CREATE TABLE foo (id DOUBLE |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (id DOUBLE ',
+            afterCursor: '',
+            dialect: 'hive',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PRECISION', 'COMMENT']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo(baa DOUBLE PRECISION, id |"', function () {
           assertAutoComplete({
           assertAutoComplete({
-            beforeCursor: 'CREATE TABLE foo(id ',
+            beforeCursor: 'CREATE TABLE foo(baa DOUBLE PRECISION, id ',
             afterCursor: '',
             afterCursor: '',
             dialect: 'hive',
             dialect: 'hive',
             containsKeywords: ['BIGINT', 'MAP<>'],
             containsKeywords: ['BIGINT', 'MAP<>'],

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlAutocompleteParser.js


+ 1 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlParseSupport.js

@@ -238,7 +238,7 @@ var SqlParseSupport = (function () {
 
 
     parser.getTypeKeywords = function () {
     parser.getTypeKeywords = function () {
       if (parser.isHive()) {
       if (parser.isHive()) {
-        return ['BIGINT', 'BINARY', 'BOOLEAN', 'CHAR', 'DATE', 'DECIMAL', 'DOUBLE', 'FLOAT', 'INT', 'SMALLINT', 'TIMESTAMP', 'STRING', 'TINYINT', 'VARCHAR'];
+        return ['BIGINT', 'BINARY', 'BOOLEAN', 'CHAR', 'DATE', 'DECIMAL', 'DOUBLE', 'DOUBLE PRECISION', 'FLOAT', 'INT', 'SMALLINT', 'TIMESTAMP', 'STRING', 'TINYINT', 'VARCHAR'];
       }
       }
       if (parser.isImpala()) {
       if (parser.isImpala()) {
         return ['BIGINT', 'BOOLEAN', 'CHAR', 'DECIMAL', 'DOUBLE', 'FLOAT', 'INT', 'REAL', 'SMALLINT', 'TIMESTAMP', 'STRING', 'TINYINT', 'VARCHAR'];
         return ['BIGINT', 'BOOLEAN', 'CHAR', 'DECIMAL', 'DOUBLE', 'FLOAT', 'INT', 'REAL', 'SMALLINT', 'TIMESTAMP', 'STRING', 'TINYINT', 'VARCHAR'];

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlSyntaxParser.js


+ 1 - 1
tools/ace-editor/lib/ace/mode/hive_highlight_rules.js

@@ -37,7 +37,7 @@ define(function (require, exports, module) {
     );
     );
 
 
     var dataTypes = (
     var dataTypes = (
-        "ARRAY|BIGINT|BINARY|BOOLEAN|CHAR|DATE|DECIMAL|DELIMITED|DOUBLE|FLOAT|INT|MAP|RCFILE|SEQUENCEFILE|SERDE|SMALLINT|STRING|STRUCT|TEXTFILE|TIMESTAMP|TINYINT|UNIONTYPE|VARCHAR"
+        "ARRAY|BIGINT|BINARY|BOOLEAN|CHAR|DATE|DECIMAL|DELIMITED|DOUBLE|FLOAT|INT|MAP|PRECISION|RCFILE|SEQUENCEFILE|SERDE|SMALLINT|STRING|STRUCT|TEXTFILE|TIMESTAMP|TINYINT|UNIONTYPE|VARCHAR"
     );
     );
 
 
     var keywordMapper = this.createKeywordMapper({
     var keywordMapper = this.createKeywordMapper({

Some files were not shown because too many files changed in this diff