diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 5ea9751..e6ca361 100644 --- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -2678,9 +2678,6 @@ private static void populateLlapDaemonVarsSet(Set llapDaemonVarsSetLocal " none: default(past) behavior. Implies only alphaNumeric and underscore are valid characters in identifiers.\n" + " column: implies column names can contain any character." ), - HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS("hive.support.sql11.reserved.keywords", true, - "This flag should be set to true to enable support for SQL2011 reserved keywords.\n" + - "The default value is true."), HIVE_SUPPORT_SPECICAL_CHARACTERS_IN_TABLE_NAMES("hive.support.special.characters.tablename", true, "This flag should be set to true to enable support for special characters in table names.\n" + "When it is set to false, only [a-zA-Z_0-9]+ are supported.\n" @@ -3977,7 +3974,6 @@ private static String getSQLStdAuthDefaultWhiteListPattern() { ConfVars.HIVE_SCHEMA_EVOLUTION.varname, ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname, ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_SERIALIZE_IN_TASKS.varname, - ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS.varname, ConfVars.HIVE_SUPPORT_SPECICAL_CHARACTERS_IN_TABLE_NAMES.varname, ConfVars.JOB_DEBUG_CAPTURE_STACKTRACES.varname, ConfVars.JOB_DEBUG_TIMEOUT.varname, diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g index bf35d60..26aca96 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g @@ -35,9 +35,6 @@ k=3; RecognitionException e) { gParent.errors.add(new ParseError(gParent, e, tokenNames)); } - protected boolean useSQL11ReservedKeywordsForIdentifier() { - return gParent.useSQL11ReservedKeywordsForIdentifier(); - } } @rulecatch { diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g index bef3acf..5c16c55 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g @@ -690,12 +690,6 @@ import org.apache.hadoop.hive.conf.HiveConf; public void setHiveConf(Configuration hiveConf) { this.hiveConf = hiveConf; } - protected boolean useSQL11ReservedKeywordsForIdentifier() { - if(hiveConf==null){ - return false; - } - return !HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS); - } } @rulecatch { @@ -2514,11 +2508,11 @@ body whereClause? groupByClause? havingClause? + window_clause? orderByClause? clusterByClause? distributeByClause? sortByClause? - window_clause? limitClause? -> ^(TOK_INSERT insertClause selectClause lateralView? whereClause? groupByClause? havingClause? orderByClause? clusterByClause? distributeByClause? sortByClause? window_clause? limitClause?) @@ -2528,11 +2522,11 @@ body whereClause? groupByClause? havingClause? + window_clause? orderByClause? clusterByClause? distributeByClause? sortByClause? - window_clause? limitClause? -> ^(TOK_INSERT ^(TOK_DESTINATION ^(TOK_DIR TOK_TMP_FILE)) selectClause lateralView? whereClause? groupByClause? havingClause? orderByClause? clusterByClause? distributeByClause? sortByClause? window_clause? limitClause?) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g index 6ae731f..c1afffb 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g @@ -35,9 +35,6 @@ k=3; RecognitionException e) { gParent.errors.add(new ParseError(gParent, e, tokenNames)); } - protected boolean useSQL11ReservedKeywordsForIdentifier() { - return gParent.useSQL11ReservedKeywordsForIdentifier(); - } } @rulecatch { @@ -206,7 +203,7 @@ functionName | (functionIdentifier) => functionIdentifier | - {!useSQL11ReservedKeywordsForIdentifier()}? sql11ReservedKeywordsUsedAsCastFunctionName -> Identifier[$sql11ReservedKeywordsUsedAsCastFunctionName.start] + sql11ReservedKeywordsUsedAsFunctionName -> Identifier[$sql11ReservedKeywordsUsedAsFunctionName.start] ; castExpression @@ -663,9 +660,6 @@ identifier : Identifier | nonReserved -> Identifier[$nonReserved.start] - // If it decides to support SQL11 reserved keywords, i.e., useSQL11ReservedKeywordsForIdentifier()=false, - // the sql11keywords in existing q tests will NOT be added back. - | {useSQL11ReservedKeywordsForIdentifier()}? sql11ReservedKeywordsUsedAsIdentifier -> Identifier[$sql11ReservedKeywordsUsedAsIdentifier.start] ; functionIdentifier @@ -725,30 +719,8 @@ nonReserved | KW_KEY ; -//The following SQL2011 reserved keywords are used as cast function name only, but not as identifiers. -sql11ReservedKeywordsUsedAsCastFunctionName +//The following SQL2011 reserved keywords are used as function name only, but not as identifiers. +sql11ReservedKeywordsUsedAsFunctionName : KW_BIGINT | KW_BINARY | KW_BOOLEAN | KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_DATE | KW_DOUBLE | KW_FLOAT | KW_INT | KW_SMALLINT | KW_TIMESTAMP - ; - -//The following SQL2011 reserved keywords are used as identifiers in many q tests, they may be added back due to backward compatibility. -//We are planning to remove the following whole list after several releases. -//Thus, please do not change the following list unless you know what to do. -sql11ReservedKeywordsUsedAsIdentifier - : - KW_ALL | KW_ALTER | KW_ARRAY | KW_AS | KW_AUTHORIZATION | KW_BETWEEN | KW_BIGINT | KW_BINARY | KW_BOOLEAN - | KW_BOTH | KW_BY | KW_CREATE | KW_CUBE | KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_CURSOR | KW_DATE | KW_DECIMAL | KW_DELETE | KW_DESCRIBE - | KW_DOUBLE | KW_DROP | KW_EXISTS | KW_EXTERNAL | KW_FALSE | KW_FETCH | KW_FLOAT | KW_FOR | KW_FULL | KW_GRANT - | KW_GROUP | KW_GROUPING | KW_IMPORT | KW_IN | KW_INNER | KW_INSERT | KW_INT | KW_INTERSECT | KW_INTO | KW_IS | KW_LATERAL - | KW_LEFT | KW_LIKE | KW_LOCAL | KW_NONE | KW_NULL | KW_OF | KW_ORDER | KW_OUT | KW_OUTER | KW_PARTITION - | KW_PERCENT | KW_PROCEDURE | KW_RANGE | KW_READS | KW_REVOKE | KW_RIGHT - | KW_ROLLUP | KW_ROW | KW_ROWS | KW_SET | KW_SMALLINT | KW_TABLE | KW_TIMESTAMP | KW_TO | KW_TRIGGER | KW_TRUE - | KW_TRUNCATE | KW_UNION | KW_UPDATE | KW_USER | KW_USING | KW_VALUES | KW_WITH -//The following two keywords come from MySQL. Although they are not keywords in SQL2011, they are reserved keywords in MySQL. - | KW_REGEXP | KW_RLIKE - | KW_PRIMARY - | KW_FOREIGN - | KW_CONSTRAINT - | KW_REFERENCES - | KW_PRECISION - ; + ; \ No newline at end of file diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g index 5f06ff4..3c6fa39 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g @@ -35,9 +35,6 @@ k=3; RecognitionException e) { gParent.errors.add(new ParseError(gParent, e, tokenNames)); } - protected boolean useSQL11ReservedKeywordsForIdentifier() { - return gParent.useSQL11ReservedKeywordsForIdentifier(); - } } @rulecatch { diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java deleted file mode 100644 index 97ae0d9..0000000 --- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java +++ /dev/null @@ -1,1103 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hive.ql.parse; - -import java.io.IOException; - -import org.apache.hadoop.hive.conf.HiveConf; -import org.apache.hadoop.hive.conf.HiveConf.ConfVars; -import org.apache.hadoop.hive.ql.Context; -import org.apache.hadoop.hive.ql.session.SessionState; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Parser tests for SQL11 Reserved KeyWords. Please find more information in - * HIVE-6617. Total number : 74 + 2 (MySQL) - */ -public class TestSQL11ReservedKeyWordsNegative { - private static HiveConf conf; - - private ParseDriver pd; - - @BeforeClass - public static void initialize() { - conf = new HiveConf(SemanticAnalyzer.class); - conf.setBoolVar(ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS, true); - SessionState.start(conf); - } - - @Before - public void setup() throws SemanticException, IOException { - pd = new ParseDriver(); - } - - ASTNode parse(String query) throws ParseException { - ASTNode nd = null; - try { - nd = pd.parse(query, new Context(conf)); - } catch (IOException e) { - e.printStackTrace(); - } - return (ASTNode) nd.getChild(0); - } - - @Test - public void testSQL11ReservedKeyWords_ALL() { - try { - parse("CREATE TABLE ALL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ALL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ALTER() { - try { - parse("CREATE TABLE ALTER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ALTER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ARRAY() { - try { - parse("CREATE TABLE ARRAY (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ARRAY'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_AS() { - try { - parse("CREATE TABLE AS (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'AS'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_AUTHORIZATION() { - try { - parse("CREATE TABLE AUTHORIZATION (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'AUTHORIZATION'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BETWEEN() { - try { - parse("CREATE TABLE BETWEEN (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BETWEEN'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BIGINT() { - try { - parse("CREATE TABLE BIGINT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BIGINT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BINARY() { - try { - parse("CREATE TABLE BINARY (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BINARY'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BOOLEAN() { - try { - parse("CREATE TABLE BOOLEAN (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BOOLEAN'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BOTH() { - try { - parse("CREATE TABLE BOTH (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BOTH'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_BY() { - try { - parse("CREATE TABLE BY (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'BY'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_CREATE() { - try { - parse("CREATE TABLE CREATE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'CREATE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_CUBE() { - try { - parse("CREATE TABLE CUBE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'CUBE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_CURRENT_DATE() { - try { - parse("CREATE TABLE CURRENT_DATE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'CURRENT_DATE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_CURRENT_TIMESTAMP() { - try { - parse("CREATE TABLE CURRENT_TIMESTAMP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'CURRENT_TIMESTAMP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_CURSOR() { - try { - parse("CREATE TABLE CURSOR (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'CURSOR'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DATE() { - try { - parse("CREATE TABLE DATE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DATE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DECIMAL() { - try { - parse("CREATE TABLE DECIMAL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DECIMAL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DELETE() { - try { - parse("CREATE TABLE DELETE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DELETE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DESCRIBE() { - try { - parse("CREATE TABLE DESCRIBE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DESCRIBE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DOUBLE() { - try { - parse("CREATE TABLE DOUBLE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DOUBLE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_DROP() { - try { - parse("CREATE TABLE DROP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'DROP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_EXISTS() { - try { - parse("CREATE TABLE EXISTS (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'EXISTS'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_EXTERNAL() { - try { - parse("CREATE TABLE EXTERNAL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'EXTERNAL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_FALSE() { - try { - parse("CREATE TABLE FALSE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'FALSE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_FETCH() { - try { - parse("CREATE TABLE FETCH (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'FETCH'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_FLOAT() { - try { - parse("CREATE TABLE FLOAT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'FLOAT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_FOR() { - try { - parse("CREATE TABLE FOR (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'FOR'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_FULL() { - try { - parse("CREATE TABLE FULL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'FULL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_GRANT() { - try { - parse("CREATE TABLE GRANT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'GRANT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_GROUP() { - try { - parse("CREATE TABLE GROUP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'GROUP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_GROUPING() { - try { - parse("CREATE TABLE GROUPING (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'GROUPING'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_IMPORT() { - try { - parse("CREATE TABLE IMPORT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'IMPORT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_IN() { - try { - parse("CREATE TABLE IN (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'IN'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_INNER() { - try { - parse("CREATE TABLE INNER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'INNER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_INSERT() { - try { - parse("CREATE TABLE INSERT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'INSERT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_INT() { - try { - parse("CREATE TABLE INT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'INT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_INTERSECT() { - try { - parse("CREATE TABLE INTERSECT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'INTERSECT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_INTO() { - try { - parse("CREATE TABLE INTO (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'INTO'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_IS() { - try { - parse("CREATE TABLE IS (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'IS'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_LATERAL() { - try { - parse("CREATE TABLE LATERAL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'LATERAL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_LEFT() { - try { - parse("CREATE TABLE LEFT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'LEFT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_LIKE() { - try { - parse("CREATE TABLE LIKE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'LIKE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_LOCAL() { - try { - parse("CREATE TABLE LOCAL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'LOCAL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_NONE() { - try { - parse("CREATE TABLE NONE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'NONE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_NULL() { - try { - parse("CREATE TABLE NULL (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'NULL'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_OF() { - try { - parse("CREATE TABLE OF (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'OF'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ORDER() { - try { - parse("CREATE TABLE ORDER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ORDER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_OUT() { - try { - parse("CREATE TABLE OUT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'OUT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_OUTER() { - try { - parse("CREATE TABLE OUTER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'OUTER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_PARTITION() { - try { - parse("CREATE TABLE PARTITION (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'PARTITION'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_PERCENT() { - try { - parse("CREATE TABLE PERCENT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'PERCENT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_PROCEDURE() { - try { - parse("CREATE TABLE PROCEDURE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'PROCEDURE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_RANGE() { - try { - parse("CREATE TABLE RANGE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'RANGE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_READS() { - try { - parse("CREATE TABLE READS (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'READS'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_REVOKE() { - try { - parse("CREATE TABLE REVOKE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'REVOKE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_RIGHT() { - try { - parse("CREATE TABLE RIGHT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'RIGHT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ROLLUP() { - try { - parse("CREATE TABLE ROLLUP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ROLLUP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ROW() { - try { - parse("CREATE TABLE ROW (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ROW'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_ROWS() { - try { - parse("CREATE TABLE ROWS (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'ROWS'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_SET() { - try { - parse("CREATE TABLE SET (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'SET'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_SMALLINT() { - try { - parse("CREATE TABLE SMALLINT (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'SMALLINT'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TABLE() { - try { - parse("CREATE TABLE TABLE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TABLE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TIMESTAMP() { - try { - parse("CREATE TABLE TIMESTAMP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TIMESTAMP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TO() { - try { - parse("CREATE TABLE TO (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert.assertEquals("Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TO'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TRIGGER() { - try { - parse("CREATE TABLE TRIGGER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TRIGGER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TRUE() { - try { - parse("CREATE TABLE TRUE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TRUE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_TRUNCATE() { - try { - parse("CREATE TABLE TRUNCATE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'TRUNCATE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_UNION() { - try { - parse("CREATE TABLE UNION (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'UNION'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_UPDATE() { - try { - parse("CREATE TABLE UPDATE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'UPDATE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_USER() { - try { - parse("CREATE TABLE USER (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'USER'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_USING() { - try { - parse("CREATE TABLE USING (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'USING'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_VALUES() { - try { - parse("CREATE TABLE VALUES (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'VALUES'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_WITH() { - try { - parse("CREATE TABLE WITH (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'WITH'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - // MySQL reserved keywords. - @Test - public void testSQL11ReservedKeyWords_RLIKE() { - try { - parse("CREATE TABLE RLIKE (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'RLIKE'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - - @Test - public void testSQL11ReservedKeyWords_REGEXP() { - try { - parse("CREATE TABLE REGEXP (col STRING)"); - Assert.assertFalse("Expected ParseException", true); - } catch (ParseException ex) { - Assert - .assertEquals( - "Failure didn't match.", - "line 1:13 Failed to recognize predicate 'REGEXP'. Failed rule: 'identifier' in table name", - ex.getMessage()); - } - } - -} diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsPositive.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsPositive.java deleted file mode 100644 index d0e6132..0000000 --- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsPositive.java +++ /dev/null @@ -1,822 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hive.ql.parse; - -import java.io.IOException; - -import org.apache.hadoop.hive.conf.HiveConf; -import org.apache.hadoop.hive.conf.HiveConf.ConfVars; -import org.apache.hadoop.hive.ql.Context; -import org.apache.hadoop.hive.ql.session.SessionState; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Parser tests for SQL11 Reserved KeyWords. Please find more information in - * HIVE-6617. Total number : 74 + 2 (MySQL) - */ -public class TestSQL11ReservedKeyWordsPositive { - private static HiveConf conf; - - private ParseDriver pd; - - @BeforeClass - public static void initialize() { - conf = new HiveConf(SemanticAnalyzer.class); - conf.setBoolVar(ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS, false); - SessionState.start(conf); - } - - @Before - public void setup() throws SemanticException, IOException { - pd = new ParseDriver(); - } - - ASTNode parse(String query) throws ParseException { - ASTNode nd = null; - try { - nd = pd.parse(query, new Context(conf)); - } catch (IOException e) { - e.printStackTrace(); - } - return (ASTNode) nd.getChild(0); - } - - @Test - public void testSQL11ReservedKeyWords_ALL() throws ParseException { - ASTNode ast = parse("CREATE TABLE ALL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname all) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ALTER() throws ParseException { - ASTNode ast = parse("CREATE TABLE ALTER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname alter) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ARRAY() throws ParseException { - ASTNode ast = parse("CREATE TABLE ARRAY (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname array) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_AS() throws ParseException { - ASTNode ast = parse("CREATE TABLE AS (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname as) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_AUTHORIZATION() throws ParseException { - ASTNode ast = parse("CREATE TABLE AUTHORIZATION (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname authorization) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BETWEEN() throws ParseException { - ASTNode ast = parse("CREATE TABLE BETWEEN (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname between) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BIGINT() throws ParseException { - ASTNode ast = parse("CREATE TABLE BIGINT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname bigint) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BINARY() throws ParseException { - ASTNode ast = parse("CREATE TABLE BINARY (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname binary) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BOOLEAN() throws ParseException { - ASTNode ast = parse("CREATE TABLE BOOLEAN (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname boolean) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BOTH() throws ParseException { - ASTNode ast = parse("CREATE TABLE BOTH (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname both) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_BY() throws ParseException { - ASTNode ast = parse("CREATE TABLE BY (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname by) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_CREATE() throws ParseException { - ASTNode ast = parse("CREATE TABLE CREATE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname create) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_CUBE() throws ParseException { - ASTNode ast = parse("CREATE TABLE CUBE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname cube) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_CURRENT_DATE() throws ParseException { - ASTNode ast = parse("CREATE TABLE CURRENT_DATE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname current_date) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_CURRENT_TIMESTAMP() throws ParseException { - ASTNode ast = parse("CREATE TABLE CURRENT_TIMESTAMP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname current_timestamp) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_CURSOR() throws ParseException { - ASTNode ast = parse("CREATE TABLE CURSOR (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname cursor) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DATE() throws ParseException { - ASTNode ast = parse("CREATE TABLE DATE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname date) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DECIMAL() throws ParseException { - ASTNode ast = parse("CREATE TABLE DECIMAL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname decimal) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DELETE() throws ParseException { - ASTNode ast = parse("CREATE TABLE DELETE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname delete) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DESCRIBE() throws ParseException { - ASTNode ast = parse("CREATE TABLE DESCRIBE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname describe) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DOUBLE() throws ParseException { - ASTNode ast = parse("CREATE TABLE DOUBLE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname double) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_DROP() throws ParseException { - ASTNode ast = parse("CREATE TABLE DROP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname drop) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_EXISTS() throws ParseException { - ASTNode ast = parse("CREATE TABLE EXISTS (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname exists) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_EXTERNAL() throws ParseException { - ASTNode ast = parse("CREATE TABLE EXTERNAL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname external) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_FALSE() throws ParseException { - ASTNode ast = parse("CREATE TABLE FALSE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname false) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_FETCH() throws ParseException { - ASTNode ast = parse("CREATE TABLE FETCH (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname fetch) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_FLOAT() throws ParseException { - ASTNode ast = parse("CREATE TABLE FLOAT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname float) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_FOR() throws ParseException { - ASTNode ast = parse("CREATE TABLE FOR (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname for) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_FULL() throws ParseException { - ASTNode ast = parse("CREATE TABLE FULL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname full) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_GRANT() throws ParseException { - ASTNode ast = parse("CREATE TABLE GRANT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname grant) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_GROUP() throws ParseException { - ASTNode ast = parse("CREATE TABLE GROUP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname group) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_GROUPING() throws ParseException { - ASTNode ast = parse("CREATE TABLE GROUPING (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname grouping) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_IMPORT() throws ParseException { - ASTNode ast = parse("CREATE TABLE IMPORT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname import) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_IN() throws ParseException { - ASTNode ast = parse("CREATE TABLE IN (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname in) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_INNER() throws ParseException { - ASTNode ast = parse("CREATE TABLE INNER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname inner) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_INSERT() throws ParseException { - ASTNode ast = parse("CREATE TABLE INSERT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname insert) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_INT() throws ParseException { - ASTNode ast = parse("CREATE TABLE INT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname int) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_INTERSECT() throws ParseException { - ASTNode ast = parse("CREATE TABLE INTERSECT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname intersect) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_INTO() throws ParseException { - ASTNode ast = parse("CREATE TABLE INTO (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname into) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_IS() throws ParseException { - ASTNode ast = parse("CREATE TABLE IS (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname is) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_LATERAL() throws ParseException { - ASTNode ast = parse("CREATE TABLE LATERAL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname lateral) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_LEFT() throws ParseException { - ASTNode ast = parse("CREATE TABLE LEFT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname left) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_LIKE() throws ParseException { - ASTNode ast = parse("CREATE TABLE LIKE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname like) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_LOCAL() throws ParseException { - ASTNode ast = parse("CREATE TABLE LOCAL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname local) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_NONE() throws ParseException { - ASTNode ast = parse("CREATE TABLE NONE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname none) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_NULL() throws ParseException { - ASTNode ast = parse("CREATE TABLE NULL (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname null) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_OF() throws ParseException { - ASTNode ast = parse("CREATE TABLE OF (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname of) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ORDER() throws ParseException { - ASTNode ast = parse("CREATE TABLE ORDER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname order) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_OUT() throws ParseException { - ASTNode ast = parse("CREATE TABLE OUT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname out) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_OUTER() throws ParseException { - ASTNode ast = parse("CREATE TABLE OUTER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname outer) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_PARTITION() throws ParseException { - ASTNode ast = parse("CREATE TABLE PARTITION (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname partition) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_PERCENT() throws ParseException { - ASTNode ast = parse("CREATE TABLE PERCENT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname percent) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_PROCEDURE() throws ParseException { - ASTNode ast = parse("CREATE TABLE PROCEDURE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname procedure) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_RANGE() throws ParseException { - ASTNode ast = parse("CREATE TABLE RANGE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname range) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_READS() throws ParseException { - ASTNode ast = parse("CREATE TABLE READS (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname reads) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_REVOKE() throws ParseException { - ASTNode ast = parse("CREATE TABLE REVOKE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname revoke) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_RIGHT() throws ParseException { - ASTNode ast = parse("CREATE TABLE RIGHT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname right) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ROLLUP() throws ParseException { - ASTNode ast = parse("CREATE TABLE ROLLUP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname rollup) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ROW() throws ParseException { - ASTNode ast = parse("CREATE TABLE ROW (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname row) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_ROWS() throws ParseException { - ASTNode ast = parse("CREATE TABLE ROWS (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname rows) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_SET() throws ParseException { - ASTNode ast = parse("CREATE TABLE SET (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname set) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_SMALLINT() throws ParseException { - ASTNode ast = parse("CREATE TABLE SMALLINT (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname smallint) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TABLE() throws ParseException { - ASTNode ast = parse("CREATE TABLE TABLE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname table) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TIMESTAMP() throws ParseException { - ASTNode ast = parse("CREATE TABLE TIMESTAMP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname timestamp) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TO() throws ParseException { - ASTNode ast = parse("CREATE TABLE TO (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname to) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TRIGGER() throws ParseException { - ASTNode ast = parse("CREATE TABLE TRIGGER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname trigger) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TRUE() throws ParseException { - ASTNode ast = parse("CREATE TABLE TRUE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname true) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_TRUNCATE() throws ParseException { - ASTNode ast = parse("CREATE TABLE TRUNCATE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname truncate) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_UNION() throws ParseException { - ASTNode ast = parse("CREATE TABLE UNION (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname union) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_UPDATE() throws ParseException { - ASTNode ast = parse("CREATE TABLE UPDATE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname update) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_USER() throws ParseException { - ASTNode ast = parse("CREATE TABLE USER (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname user) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_USING() throws ParseException { - ASTNode ast = parse("CREATE TABLE USING (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname using) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_VALUES() throws ParseException { - ASTNode ast = parse("CREATE TABLE VALUES (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname values) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_WITH() throws ParseException { - ASTNode ast = parse("CREATE TABLE WITH (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname with) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - // MySQL reserved keywords. - @Test - public void testSQL11ReservedKeyWords_RLIKE() throws ParseException { - ASTNode ast = parse("CREATE TABLE RLIKE (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname rlike) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } - - @Test - public void testSQL11ReservedKeyWords_REGEXP() throws ParseException { - ASTNode ast = parse("CREATE TABLE REGEXP (col STRING)"); - Assert - .assertEquals( - "AST doesn't match", - "(tok_createtable (tok_tabname regexp) tok_liketable (tok_tabcollist (tok_tabcol col tok_string)))", - ast.toStringTree()); - } -} diff --git a/ql/src/test/queries/clientpositive/keyword_2.q b/ql/src/test/queries/clientpositive/keyword_2.q index 054e26a..e8be760 100644 --- a/ql/src/test/queries/clientpositive/keyword_2.q +++ b/ql/src/test/queries/clientpositive/keyword_2.q @@ -1,4 +1,3 @@ -set hive.support.sql11.reserved.keywords=false; drop table varchar_udf_1; create table varchar_udf_1 (c1 string, c2 string, c3 varchar(10), c4 varchar(20)); @@ -6,9 +5,9 @@ insert overwrite table varchar_udf_1 select key, value, key, value from src where key = '238' limit 1; select - regexp(c2, 'val'), - regexp(c4, 'val'), - regexp(c2, 'val') = regexp(c4, 'val') + c2 regexp 'val', + c4 regexp 'val', + (c2 regexp 'val') = (c4 regexp 'val') from varchar_udf_1 limit 1; drop table varchar_udf_1; diff --git a/ql/src/test/queries/clientpositive/ppd_field_garbage.q b/ql/src/test/queries/clientpositive/ppd_field_garbage.q index 67bea5c..85021f1 100644 --- a/ql/src/test/queries/clientpositive/ppd_field_garbage.q +++ b/ql/src/test/queries/clientpositive/ppd_field_garbage.q @@ -1,8 +1,6 @@ -set hive.support.sql11.reserved.keywords=false; --- We need the above setting for backward compatibility because 'user' is a keyword in SQL2011 -- ppd leaves invalid expr in field expr -CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>); -CREATE VIEW v_test_issue AS SELECT fileid, i.user, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i; +CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>); +CREATE VIEW v_test_issue AS SELECT fileid, i.u, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i; -- dummy data LOAD DATA LOCAL INPATH '../../data/files/kv1.txt' INTO TABLE test_issue; diff --git a/ql/src/test/queries/clientpositive/udaf_collect_set_2.q b/ql/src/test/queries/clientpositive/udaf_collect_set_2.q index d18509b..769655b 100644 --- a/ql/src/test/queries/clientpositive/udaf_collect_set_2.q +++ b/ql/src/test/queries/clientpositive/udaf_collect_set_2.q @@ -1,5 +1,3 @@ -set hive.support.sql11.reserved.keywords=false; - DESCRIBE FUNCTION collect_set; DESCRIBE FUNCTION EXTENDED collect_set; @@ -15,13 +13,13 @@ FIELDS TERMINATED BY ','; LOAD DATA LOCAL INPATH "../../data/files/customers.txt" INTO TABLE customers; -CREATE TABLE orders (id int, cid int, date date, amount double) +CREATE TABLE orders (id int, cid int, d date, amount double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','; LOAD DATA LOCAL INPATH "../../data/files/orders.txt" INTO TABLE orders; -CREATE TABLE nested_orders (id int, cid int, date date, sub map) +CREATE TABLE nested_orders (id int, cid int, d date, sub map) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' COLLECTION ITEMS TERMINATED BY '$' @@ -33,35 +31,35 @@ LOAD DATA LOCAL INPATH "../../data/files/nested_orders.txt" INTO TABLE nested_or -- 1.1 when field is primitive -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; -- cast decimal -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.amount))) +SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.amount))) +SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id; @@ -69,22 +67,22 @@ ON (c.id = o.cid) GROUP BY c.id; -- 1.2 when field is map -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.sub))) +SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.sub))) +SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; @@ -92,22 +90,22 @@ ON (c.id = o.cid) GROUP BY c.id; -- 1.3 when field is list -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_set(struct(c.name, o.date, map_values(o.sub)))) +SELECT c.id, sort_array(collect_set(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; -SELECT c.id, sort_array(collect_list(struct(c.name, o.date, map_values(o.sub)))) +SELECT c.id, sort_array(collect_list(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id; diff --git a/ql/src/test/results/clientnegative/authorization_cannot_create_all_role.q.out b/ql/src/test/results/clientnegative/authorization_cannot_create_all_role.q.out index 3bc663b..0bb8788 100644 --- a/ql/src/test/results/clientnegative/authorization_cannot_create_all_role.q.out +++ b/ql/src/test/results/clientnegative/authorization_cannot_create_all_role.q.out @@ -2,4 +2,4 @@ PREHOOK: query: set role ADMIN PREHOOK: type: SHOW_ROLES POSTHOOK: query: set role ADMIN POSTHOOK: type: SHOW_ROLES -FAILED: ParseException line 2:12 Failed to recognize predicate 'all'. Failed rule: 'identifier' in create role +FAILED: ParseException line 2:12 cannot recognize input near 'all' '' '' in create role diff --git a/ql/src/test/results/clientnegative/authorization_cannot_create_none_role.q.out b/ql/src/test/results/clientnegative/authorization_cannot_create_none_role.q.out index a8f6c1c..618cba6 100644 --- a/ql/src/test/results/clientnegative/authorization_cannot_create_none_role.q.out +++ b/ql/src/test/results/clientnegative/authorization_cannot_create_none_role.q.out @@ -2,4 +2,4 @@ PREHOOK: query: set role ADMIN PREHOOK: type: SHOW_ROLES POSTHOOK: query: set role ADMIN POSTHOOK: type: SHOW_ROLES -FAILED: ParseException line 2:12 Failed to recognize predicate 'None'. Failed rule: 'identifier' in create role +FAILED: ParseException line 2:12 cannot recognize input near 'None' '' '' in create role diff --git a/ql/src/test/results/clientnegative/cte_with_in_subquery.q.out b/ql/src/test/results/clientnegative/cte_with_in_subquery.q.out index 1122ca5..2ead43b 100644 --- a/ql/src/test/results/clientnegative/cte_with_in_subquery.q.out +++ b/ql/src/test/results/clientnegative/cte_with_in_subquery.q.out @@ -1 +1 @@ -FAILED: ParseException line 1:20 cannot recognize input near 'with' 'q1' 'as' in from source +FAILED: SemanticException [Error 10001]: Line 1:44 Table not found 'q2' diff --git a/ql/src/test/results/clientnegative/lateral_view_join.q.out b/ql/src/test/results/clientnegative/lateral_view_join.q.out index 74a7ea5..b96f18f 100644 --- a/ql/src/test/results/clientnegative/lateral_view_join.q.out +++ b/ql/src/test/results/clientnegative/lateral_view_join.q.out @@ -1 +1 @@ -FAILED: ParseException line 1:59 Failed to recognize predicate 'AS'. Failed rule: 'identifier' in table alias +FAILED: ParseException line 1:59 cannot recognize input near 'AS' 'myTable' 'JOIN' in table alias diff --git a/ql/src/test/results/clientnegative/subq_insert.q.out b/ql/src/test/results/clientnegative/subq_insert.q.out index 4847634..620409b 100644 --- a/ql/src/test/results/clientnegative/subq_insert.q.out +++ b/ql/src/test/results/clientnegative/subq_insert.q.out @@ -1 +1 @@ -FAILED: ParseException line 2:22 cannot recognize input near 'INSERT' 'OVERWRITE' 'TABLE' in from source +FAILED: SemanticException [Error 10024]: Line 2:38 Cannot insert in a subquery. Inserting to table 'src1' diff --git a/ql/src/test/results/clientpositive/keyword_2.q.out b/ql/src/test/results/clientpositive/keyword_2.q.out index 3d248fb..c8389f5 100644 --- a/ql/src/test/results/clientpositive/keyword_2.q.out +++ b/ql/src/test/results/clientpositive/keyword_2.q.out @@ -25,17 +25,17 @@ POSTHOOK: Lineage: varchar_udf_1.c2 SIMPLE [(src)src.FieldSchema(name:value, typ POSTHOOK: Lineage: varchar_udf_1.c3 EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ] POSTHOOK: Lineage: varchar_udf_1.c4 EXPRESSION [(src)src.FieldSchema(name:value, type:string, comment:default), ] PREHOOK: query: select - regexp(c2, 'val'), - regexp(c4, 'val'), - regexp(c2, 'val') = regexp(c4, 'val') + c2 regexp 'val', + c4 regexp 'val', + (c2 regexp 'val') = (c4 regexp 'val') from varchar_udf_1 limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@varchar_udf_1 #### A masked pattern was here #### POSTHOOK: query: select - regexp(c2, 'val'), - regexp(c4, 'val'), - regexp(c2, 'val') = regexp(c4, 'val') + c2 regexp 'val', + c4 regexp 'val', + (c2 regexp 'val') = (c4 regexp 'val') from varchar_udf_1 limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@varchar_udf_1 diff --git a/ql/src/test/results/clientpositive/ppd_field_garbage.q.out b/ql/src/test/results/clientpositive/ppd_field_garbage.q.out index 1ce7a39..bf16dd7 100644 --- a/ql/src/test/results/clientpositive/ppd_field_garbage.q.out +++ b/ql/src/test/results/clientpositive/ppd_field_garbage.q.out @@ -1,21 +1,19 @@ -PREHOOK: query: -- We need the above setting for backward compatibility because 'user' is a keyword in SQL2011 --- ppd leaves invalid expr in field expr -CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>) +PREHOOK: query: -- ppd leaves invalid expr in field expr +CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>) PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@test_issue -POSTHOOK: query: -- We need the above setting for backward compatibility because 'user' is a keyword in SQL2011 --- ppd leaves invalid expr in field expr -CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>) +POSTHOOK: query: -- ppd leaves invalid expr in field expr +CREATE TABLE test_issue (fileid int, infos ARRAY>, test_c STRUCT>) POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@test_issue -PREHOOK: query: CREATE VIEW v_test_issue AS SELECT fileid, i.user, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i +PREHOOK: query: CREATE VIEW v_test_issue AS SELECT fileid, i.u, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i PREHOOK: type: CREATEVIEW PREHOOK: Input: default@test_issue PREHOOK: Output: database:default PREHOOK: Output: default@v_test_issue -POSTHOOK: query: CREATE VIEW v_test_issue AS SELECT fileid, i.user, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i +POSTHOOK: query: CREATE VIEW v_test_issue AS SELECT fileid, i.u, test_c.user_c.age FROM test_issue LATERAL VIEW explode(infos) info AS i POSTHOOK: type: CREATEVIEW POSTHOOK: Input: default@test_issue POSTHOOK: Output: database:default diff --git a/ql/src/test/results/clientpositive/udaf_collect_set_2.q.out b/ql/src/test/results/clientpositive/udaf_collect_set_2.q.out index 7425988..f2e76a7 100644 --- a/ql/src/test/results/clientpositive/udaf_collect_set_2.q.out +++ b/ql/src/test/results/clientpositive/udaf_collect_set_2.q.out @@ -42,13 +42,13 @@ POSTHOOK: query: LOAD DATA LOCAL INPATH "../../data/files/customers.txt" INTO TA POSTHOOK: type: LOAD #### A masked pattern was here #### POSTHOOK: Output: default@customers -PREHOOK: query: CREATE TABLE orders (id int, cid int, date date, amount double) +PREHOOK: query: CREATE TABLE orders (id int, cid int, d date, amount double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@orders -POSTHOOK: query: CREATE TABLE orders (id int, cid int, date date, amount double) +POSTHOOK: query: CREATE TABLE orders (id int, cid int, d date, amount double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' POSTHOOK: type: CREATETABLE @@ -62,7 +62,7 @@ POSTHOOK: query: LOAD DATA LOCAL INPATH "../../data/files/orders.txt" INTO TABLE POSTHOOK: type: LOAD #### A masked pattern was here #### POSTHOOK: Output: default@orders -PREHOOK: query: CREATE TABLE nested_orders (id int, cid int, date date, sub map) +PREHOOK: query: CREATE TABLE nested_orders (id int, cid int, d date, sub map) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' COLLECTION ITEMS TERMINATED BY '$' @@ -70,7 +70,7 @@ MAP KEYS TERMINATED BY ':' PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@nested_orders -POSTHOOK: query: CREATE TABLE nested_orders (id int, cid int, date date, sub map) +POSTHOOK: query: CREATE TABLE nested_orders (id int, cid int, d date, sub map) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' COLLECTION ITEMS TERMINATED BY '$' @@ -90,7 +90,7 @@ PREHOOK: query: -- 1. test struct -- 1.1 when field is primitive -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -102,7 +102,7 @@ POSTHOOK: query: -- 1. test struct -- 1.1 when field is primitive -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -113,7 +113,7 @@ POSTHOOK: Input: default@orders 1 [{"name":"Chris","date":"2013-06-21","amount":21.45},{"name":"Chris","date":"2014-10-11","amount":29.36}] 2 [{"name":"John","date":"2013-08-10","amount":126.57},{"name":"John","date":"2014-06-25","amount":3.65},{"name":"John","date":"2015-01-15","amount":27.45}] 3 [{"name":"Martin","date":"2014-05-11","amount":30.5},{"name":"Martin","date":"2014-12-12","amount":210.03}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -121,7 +121,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", o.amount))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -134,7 +134,7 @@ POSTHOOK: Input: default@orders 3 [{"name":"Martin","date":"2014-05-11","amount":30.5},{"name":"Martin","date":"2014-12-12","amount":210.03}] PREHOOK: query: -- cast decimal -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -144,7 +144,7 @@ PREHOOK: Input: default@orders #### A masked pattern was here #### POSTHOOK: query: -- cast decimal -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -155,7 +155,7 @@ POSTHOOK: Input: default@orders 1 [{"name":"Chris","date":"2013-06-21","amount":21.5},{"name":"Chris","date":"2014-10-11","amount":29.4}] 2 [{"name":"John","date":"2013-08-10","amount":126.6},{"name":"John","date":"2014-06-25","amount":3.7},{"name":"John","date":"2015-01-15","amount":27.5}] 3 [{"name":"Martin","date":"2014-05-11","amount":30.5},{"name":"Martin","date":"2014-12-12","amount":210}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -163,7 +163,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "amount", cast(o.amount as decimal(10,1))))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "amount", cast(o.amount as decimal(10,1))))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -174,7 +174,7 @@ POSTHOOK: Input: default@orders 1 [{"name":"Chris","date":"2013-06-21","amount":21.5},{"name":"Chris","date":"2013-06-21","amount":21.5},{"name":"Chris","date":"2014-10-11","amount":29.4}] 2 [{"name":"John","date":"2013-08-10","amount":126.6},{"name":"John","date":"2014-06-25","amount":3.7},{"name":"John","date":"2015-01-15","amount":27.5}] 3 [{"name":"Martin","date":"2014-05-11","amount":30.5},{"name":"Martin","date":"2014-12-12","amount":210}] -PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.amount))) +PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -182,7 +182,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.amount))) +POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -193,7 +193,7 @@ POSTHOOK: Input: default@orders 1 [{"col1":"Chris","col2":"2013-06-21","col3":21.45},{"col1":"Chris","col2":"2014-10-11","col3":29.36}] 2 [{"col1":"John","col2":"2013-08-10","col3":126.57},{"col1":"John","col2":"2014-06-25","col3":3.65},{"col1":"John","col2":"2015-01-15","col3":27.45}] 3 [{"col1":"Martin","col2":"2014-05-11","col3":30.5},{"col1":"Martin","col2":"2014-12-12","col3":210.03}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.amount))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -201,7 +201,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.amount))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.amount))) FROM customers c INNER JOIN orders o ON (c.id = o.cid) GROUP BY c.id @@ -214,7 +214,7 @@ POSTHOOK: Input: default@orders 3 [{"col1":"Martin","col2":"2014-05-11","col3":30.5},{"col1":"Martin","col2":"2014-12-12","col3":210.03}] PREHOOK: query: -- 1.2 when field is map -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -224,7 +224,7 @@ PREHOOK: Input: default@nested_orders #### A masked pattern was here #### POSTHOOK: query: -- 1.2 when field is map -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -235,7 +235,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"name":"Chris","date":"2013-06-21","sub":{"\"juice\"":21.45,"\"bread\"":15.2}},{"name":"Chris","date":"2014-10-11","sub":{"\"grape\"":1200.5,"\"rice\"":29.36}}] 2 [{"name":"John","date":"2013-08-10","sub":{"\"yogurt\"":126.57,"\"beef\"":210.57}},{"name":"John","date":"2014-06-25","sub":{"\"chocolate\"":3.65,"\"water\"":420.36}},{"name":"John","date":"2015-01-15","sub":{"\"milk\"":27.45}}] 3 [{"name":"Martin","date":"2014-05-11","sub":{"\"apple\"":30.5,"\"orange\"":41.35}},{"name":"Martin","date":"2014-12-12","sub":{"\"icecream\"":210.03,"\"banana\"":100.56,"\"coffee":500.0}}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -243,7 +243,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", o.sub))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -254,7 +254,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"name":"Chris","date":"2013-06-21","sub":{"\"juice\"":21.45,"\"bread\"":15.2}},{"name":"Chris","date":"2013-06-21","sub":{"\"juice\"":21.45,"\"bread\"":15.2}},{"name":"Chris","date":"2014-10-11","sub":{"\"grape\"":1200.5,"\"rice\"":29.36}}] 2 [{"name":"John","date":"2013-08-10","sub":{"\"yogurt\"":126.57,"\"beef\"":210.57}},{"name":"John","date":"2014-06-25","sub":{"\"chocolate\"":3.65,"\"water\"":420.36}},{"name":"John","date":"2015-01-15","sub":{"\"milk\"":27.45}}] 3 [{"name":"Martin","date":"2014-05-11","sub":{"\"apple\"":30.5,"\"orange\"":41.35}},{"name":"Martin","date":"2014-12-12","sub":{"\"icecream\"":210.03,"\"banana\"":100.56,"\"coffee":500.0}}] -PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.sub))) +PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -262,7 +262,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, o.sub))) +POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -273,7 +273,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"col1":"Chris","col2":"2013-06-21","col3":{"\"juice\"":21.45,"\"bread\"":15.2}},{"col1":"Chris","col2":"2014-10-11","col3":{"\"grape\"":1200.5,"\"rice\"":29.36}}] 2 [{"col1":"John","col2":"2013-08-10","col3":{"\"yogurt\"":126.57,"\"beef\"":210.57}},{"col1":"John","col2":"2014-06-25","col3":{"\"chocolate\"":3.65,"\"water\"":420.36}},{"col1":"John","col2":"2015-01-15","col3":{"\"milk\"":27.45}}] 3 [{"col1":"Martin","col2":"2014-05-11","col3":{"\"apple\"":30.5,"\"orange\"":41.35}},{"col1":"Martin","col2":"2014-12-12","col3":{"\"icecream\"":210.03,"\"banana\"":100.56,"\"coffee":500.0}}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.sub))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -281,7 +281,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, o.sub))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, o.sub))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -294,7 +294,7 @@ POSTHOOK: Input: default@nested_orders 3 [{"col1":"Martin","col2":"2014-05-11","col3":{"\"apple\"":30.5,"\"orange\"":41.35}},{"col1":"Martin","col2":"2014-12-12","col3":{"\"icecream\"":210.03,"\"banana\"":100.56,"\"coffee":500.0}}] PREHOOK: query: -- 1.3 when field is list -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -304,7 +304,7 @@ PREHOOK: Input: default@nested_orders #### A masked pattern was here #### POSTHOOK: query: -- 1.3 when field is list -SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +SELECT c.id, sort_array(collect_set(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -315,7 +315,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"name":"Chris","date":"2013-06-21","sub":[21.45,15.2]},{"name":"Chris","date":"2014-10-11","sub":[1200.5,29.36]}] 2 [{"name":"John","date":"2013-08-10","sub":[126.57,210.57]},{"name":"John","date":"2014-06-25","sub":[3.65,420.36]},{"name":"John","date":"2015-01-15","sub":[27.45]}] 3 [{"name":"Martin","date":"2014-05-11","sub":[30.5,41.35]},{"name":"Martin","date":"2014-12-12","sub":[210.03,100.56,500.0]}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -323,7 +323,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.date, "sub", map_values(o.sub)))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(named_struct("name", c.name, "date", o.d, "sub", map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -334,7 +334,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"name":"Chris","date":"2013-06-21","sub":[21.45,15.2]},{"name":"Chris","date":"2013-06-21","sub":[21.45,15.2]},{"name":"Chris","date":"2014-10-11","sub":[1200.5,29.36]}] 2 [{"name":"John","date":"2013-08-10","sub":[126.57,210.57]},{"name":"John","date":"2014-06-25","sub":[3.65,420.36]},{"name":"John","date":"2015-01-15","sub":[27.45]}] 3 [{"name":"Martin","date":"2014-05-11","sub":[30.5,41.35]},{"name":"Martin","date":"2014-12-12","sub":[210.03,100.56,500.0]}] -PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, map_values(o.sub)))) +PREHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -342,7 +342,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.date, map_values(o.sub)))) +POSTHOOK: query: SELECT c.id, sort_array(collect_set(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -353,7 +353,7 @@ POSTHOOK: Input: default@nested_orders 1 [{"col1":"Chris","col2":"2013-06-21","col3":[21.45,15.2]},{"col1":"Chris","col2":"2014-10-11","col3":[1200.5,29.36]}] 2 [{"col1":"John","col2":"2013-08-10","col3":[126.57,210.57]},{"col1":"John","col2":"2014-06-25","col3":[3.65,420.36]},{"col1":"John","col2":"2015-01-15","col3":[27.45]}] 3 [{"col1":"Martin","col2":"2014-05-11","col3":[30.5,41.35]},{"col1":"Martin","col2":"2014-12-12","col3":[210.03,100.56,500.0]}] -PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, map_values(o.sub)))) +PREHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id @@ -361,7 +361,7 @@ PREHOOK: type: QUERY PREHOOK: Input: default@customers PREHOOK: Input: default@nested_orders #### A masked pattern was here #### -POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.date, map_values(o.sub)))) +POSTHOOK: query: SELECT c.id, sort_array(collect_list(struct(c.name, o.d, map_values(o.sub)))) FROM customers c INNER JOIN nested_orders o ON (c.id = o.cid) GROUP BY c.id diff --git a/ql/src/test/results/compiler/errors/missing_overwrite.q.out b/ql/src/test/results/compiler/errors/missing_overwrite.q.out index 7fed7a5..441558a 100644 --- a/ql/src/test/results/compiler/errors/missing_overwrite.q.out +++ b/ql/src/test/results/compiler/errors/missing_overwrite.q.out @@ -1 +1 @@ -Parse Error: line 2:7 cannot recognize input near 'INSERT' 'TABLE' 'dest1' in table source \ No newline at end of file +Parse Error: line 2:0 cannot recognize input near 'INSERT' 'TABLE' 'dest1' in insert clause \ No newline at end of file