فهرست منبع

HUE-9055 [hive] INTEGER is introduced as a synonym for INT in 2.2

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-IntegralTypes(TINYINT,SMALLINT,INT/INTEGER,BIGINT)

Notes:

1. Added a new 'INTEGER' keyword. Maybe could have done instead:
KW_INT: 'INT' | 'INTEGER'

2. Only added a new test and updated a few ones, did not add 'INTEGER'
everywhere we have 'INT' in the tests to be less noisy.

3. Do not forget to update parser.getTypeKeywords
Romain 6 سال پیش
والد
کامیت
27cc3ea991

+ 1 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/sql.jisonlex

@@ -82,6 +82,7 @@
 'INNER'                              { return 'INNER'; }
 'INSERT'                             { parser.determineCase(yytext); return 'INSERT'; }
 'INT'                                { return 'INT'; }
+'INTEGER'                            { return 'INTEGER'; }
 'INTO'                               { return 'INTO'; }
 'IS'                                 { return 'IS'; }
 'JOIN'                               { return 'JOIN'; }

+ 9 - 7
desktop/core/src/desktop/js/parse/jison/sql/hive/sql_main.jison

@@ -370,6 +370,7 @@ NonStartingToken
  | 'INPATH'
  | 'INPUTFORMAT'
  | 'INT'
+ | 'INTEGER'
  | 'INTO'
  | 'IS'
  | 'ITEMS'
@@ -1121,6 +1122,7 @@ PrimitiveType
  | 'DOUBLE_PRECISION'
  | 'FLOAT'
  | 'INT'
+ | 'INTEGER'
  | 'SMALLINT'
  | 'STRING'
  | 'TIMESTAMP'
@@ -3456,35 +3458,35 @@ CountFunction_EDIT
  ;
 
 ExtractFunction
- : 'EXTRACT' '(' DateField 'FROM' ValueExpression ')'  -> { types: ['INT'] }
+ : 'EXTRACT' '(' DateField 'FROM' ValueExpression ')'  -> { types: ['INT', 'INTEGER'] }
  ;
 
 ExtractFunction_EDIT
  : 'EXTRACT' '(' AnyCursor RightParenthesisOrError
    {
      parser.suggestKeywords(['DAY', 'DAYOFWEEK', 'HOUR', 'MINUTE', 'MONTH', 'QUARTER', 'SECOND', 'WEEK', 'YEAR']);
-     $$ = { types: ['INT'] }
+     $$ = { types: ['INT', 'INTEGER'] }
    }
  | 'EXTRACT' '(' DateField 'CURSOR' RightParenthesisOrError
    {
      parser.suggestKeywords(['FROM']);
-     $$ = { types: ['INT'] }
+     $$ = { types: ['INT', 'INTEGER'] }
    }
  | 'EXTRACT' '(' DateField 'FROM' 'CURSOR' RightParenthesisOrError
    {
      parser.valueExpressionSuggest();
-     $$ = { types: ['INT'] }
+     $$ = { types: ['INT', 'INTEGER'] }
    }
- | 'EXTRACT' '(' DateField 'FROM' ValueExpression_EDIT RightParenthesisOrError  -> { types: ['INT'] }
+ | 'EXTRACT' '(' DateField 'FROM' ValueExpression_EDIT RightParenthesisOrError  -> { types: ['INT', 'INTEGER'] }
  | 'EXTRACT' '(' AnyCursor 'FROM' ValueExpression RightParenthesisOrError
    {
       parser.suggestKeywords(['DAY', 'DAYOFWEEK', 'HOUR', 'MINUTE', 'MONTH', 'QUARTER', 'SECOND', 'WEEK', 'YEAR']);
-      $$ = { types: ['INT'] }
+      $$ = { types: ['INT', 'INTEGER'] }
    }
  | 'EXTRACT' '(' DateField 'CURSOR' ValueExpression RightParenthesisOrError
    {
      parser.suggestKeywords(['FROM']);
-     $$ = { types: ['INT'] }
+     $$ = { types: ['INT', 'INTEGER'] }
    }
  ;
 

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


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


+ 1 - 1
desktop/core/src/desktop/js/parse/sql/hive/spec/hiveAutocompleteParser_Alter_Spec.js

@@ -361,7 +361,7 @@ describe('hiveAutocompleteParser.js ALTER statements', () => {
       assertAutoComplete({
         beforeCursor: 'ALTER TABLE bar ADD COLUMNS (boo ',
         afterCursor: '',
-        containsKeywords: ['INT', 'STRUCT<>'],
+        containsKeywords: ['INT', 'INTEGER', 'STRUCT<>'],
         expectedResult: {
           lowerCase: false
         }

+ 11 - 0
desktop/core/src/desktop/js/parse/sql/hive/spec/hiveAutocompleteParser_Create_Spec.js

@@ -684,6 +684,17 @@ describe('hiveAutocompleteParser.js CREATE statements', () => {
       });
     });
 
+    it('should handle for "CREATE TABLE foo (id INTEGER);|"', () => {
+      assertAutoComplete({
+        beforeCursor: 'CREATE TABLE foo (id INTEGER);',
+        afterCursor: '',
+        containsKeywords: ['SELECT'],
+        expectedResult: {
+          lowerCase: false
+        }
+      });
+    });
+
     it('should suggest keywords for "CREATE TABLE foo (id |"', () => {
       assertAutoComplete({
         beforeCursor: 'CREATE TABLE foo (id ',

+ 1 - 1
desktop/core/src/desktop/js/parse/sql/hive/spec/hiveAutocompleteParser_Select_Spec.js

@@ -2211,7 +2211,7 @@ describe('hiveAutocompleteParser.js SELECT statements', () => {
       assertAutoComplete({
         beforeCursor: 'select cast(bla as ',
         afterCursor: '',
-        containsKeywords: ['INT', 'STRING'],
+        containsKeywords: ['INT', 'INTEGER', 'STRING'],
         expectedResult: {
           lowerCase: true
         }

+ 1 - 0
desktop/core/src/desktop/js/parse/sql/hive/sqlParseSupport.js

@@ -249,6 +249,7 @@ const initSqlParser = function(parser) {
       'DOUBLE PRECISION',
       'FLOAT',
       'INT',
+      'INTEGER',
       'SMALLINT',
       'TIMESTAMP',
       'STRING',

+ 16 - 0
desktop/core/src/desktop/js/sql/sqlFunctions.js

@@ -4175,6 +4175,7 @@ const SqlFunctions = (function() {
         TINYINT: false,
         SMALLINT: false,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4193,6 +4194,7 @@ const SqlFunctions = (function() {
         TINYINT: false,
         SMALLINT: false,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4211,6 +4213,7 @@ const SqlFunctions = (function() {
         TINYINT: false,
         SMALLINT: false,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4229,6 +4232,7 @@ const SqlFunctions = (function() {
         TINYINT: false,
         SMALLINT: false,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4247,6 +4251,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: false,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4265,6 +4270,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: false,
+        INTEGER: false,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4283,6 +4289,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: false,
         FLOAT: false,
         DOUBLE: false,
@@ -4301,6 +4308,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: false,
         DOUBLE: false,
@@ -4319,6 +4327,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: false,
@@ -4337,6 +4346,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4355,6 +4365,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4373,6 +4384,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4391,6 +4403,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4409,6 +4422,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4427,6 +4441,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,
@@ -4445,6 +4460,7 @@ const SqlFunctions = (function() {
         TINYINT: true,
         SMALLINT: true,
         INT: true,
+        INTEGER: true,
         BIGINT: true,
         FLOAT: true,
         DOUBLE: true,

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