You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "WencongLiu (via GitHub)" <gi...@apache.org> on 2024/04/28 10:59:09 UTC

[PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

WencongLiu opened a new pull request, #18:
URL: https://github.com/apache/flink-connector-hive/pull/18

   ## What is the purpose of the change
   
   According to Hive user documentation[1], starting from version 0.13.0, Hive prohibits the use of reserved keywords as identifiers. Moreover, versions 2.1.0 and earlier allow using SQL11 reserved keywords as identifiers by setting `hive.support.sql11.reserved.keywords=false` in hive-site.xml. This compatibility feature facilitates jobs that utilize keywords as identifiers.
   
   HiveParser in Flink, relying on Hive version 2.3.9, lacks the option to treat SQL11 reserved keywords as identifiers. This poses a challenge for users migrating SQL from Hive 1.x to Flink SQL, as they might encounter scenarios where keywords are used as identifiers. Addressing this issue is necessary to support such cases.
   
   [1] [LanguageManual DDL - Apache Hive - Apache Software Foundation](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL)
   
   
   ## Brief change log
   
     - *Modify the ANTLR Files for Parsing Hive Syntax.*
     - *Add introduction in docs.*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? docs
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1594867337


##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g:
##########
@@ -721,6 +722,12 @@ import org.apache.flink.table.planner.delegation.hive.copy.HiveASTParseError;
   public void setHiveConf(Configuration hiveConf) {
     this.hiveConf = hiveConf;
   }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    if(hiveConf==null){
+      return false;
+    }
+    return !hiveConf.getBoolean(SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME, true);

Review Comment:
   nit:
   ```suggestion
       return hiveConf.getBoolean(SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME, false);
   ```



##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {

Review Comment:
   ```suggestion
   class HiveDialectSupportSQL11ReservedKeywordAsIdentifierITCase {
   ```



##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */

Review Comment:
   ```suggestion
   /** Test with SQL11 reserved keywords in hive queries. */
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1606184817


##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserConstants.java:
##########
@@ -30,4 +30,6 @@ public class HiveParserConstants {
     /* Constants for insert overwrite directory */
     public static final String IS_INSERT_DIRECTORY = "is-insert-directory";
     public static final String IS_TO_LOCAL_DIRECTORY = "is-to-local-directory";
+    public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME =

Review Comment:
   I've renamed it to `HIVE_SUPPORT_SQL_11_RESERVED_KEYWORDS`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1594867337


##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/parse/HiveASTParser.g:
##########
@@ -721,6 +722,12 @@ import org.apache.flink.table.planner.delegation.hive.copy.HiveASTParseError;
   public void setHiveConf(Configuration hiveConf) {
     this.hiveConf = hiveConf;
   }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    if(hiveConf==null){
+      return false;
+    }
+    return !hiveConf.getBoolean(SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME, true);

Review Comment:
   nit:
   ```suggestion
       return hiveConf.getBoolean(SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME, false);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1602571412


##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);
+        sql11ReservedKeywords =
+                new ArrayList<>(
+                        Arrays.asList(

Review Comment:
   Why we need the outer `new ArrayList<>`?



##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserConstants.java:
##########
@@ -30,4 +30,6 @@ public class HiveParserConstants {
     /* Constants for insert overwrite directory */
     public static final String IS_INSERT_DIRECTORY = "is-insert-directory";
     public static final String IS_TO_LOCAL_DIRECTORY = "is-to-local-directory";
+    public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME =

Review Comment:
   ```suggestion
       public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS =
   ```



##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);

Review Comment:
   What's the role this line play?



##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);
+        sql11ReservedKeywords =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "ALL",
+                                "ALTER",
+                                "ARRAY",
+                                "AS",
+                                "AUTHORIZATION",
+                                "BETWEEN",
+                                "BIGINT",
+                                "BINARY",
+                                "BOOLEAN",
+                                "BOTH",
+                                "BY",
+                                "CREATE",
+                                "CUBE",
+                                "CURRENT_DATE",
+                                "CURRENT_TIMESTAMP",
+                                "CURSOR",
+                                "DATE",
+                                "DECIMAL",
+                                "DELETE",
+                                "DESCRIBE",
+                                "DOUBLE",
+                                "DROP",
+                                "EXISTS",
+                                "EXTERNAL",
+                                "FALSE",
+                                "FETCH",
+                                "FLOAT",
+                                "FOR",
+                                "FULL",
+                                "GRANT",
+                                "GROUP",
+                                "GROUPING",
+                                "IMPORT",
+                                "IN",
+                                "INNER",
+                                "INSERT",
+                                "INT",
+                                "INTERSECT",
+                                "INTO",
+                                "IS",
+                                "LATERAL",
+                                "LEFT",
+                                "LIKE",
+                                "LOCAL",
+                                "NONE",
+                                "NULL",
+                                "OF",
+                                "ORDER",
+                                "OUT",
+                                "OUTER",
+                                "PARTITION",
+                                "PERCENT",
+                                "PROCEDURE",
+                                "RANGE",
+                                "READS",
+                                "REVOKE",
+                                "RIGHT",
+                                "ROLLUP",
+                                "ROW",
+                                "ROWS",
+                                "SET",
+                                "SMALLINT",
+                                "TABLE",
+                                "TIMESTAMP",
+                                "TO",
+                                "TRIGGER",
+                                "TRUE",
+                                "TRUNCATE",
+                                "UNION",
+                                "UPDATE",
+                                "USER",
+                                "USING",
+                                "VALUES",
+                                "WITH",
+                                "REGEXP",
+                                "RLIKE",
+                                "PRIMARY",
+                                "FOREIGN",
+                                "CONSTRAINT",
+                                "REFERENCES",
+                                "PRECISION"));
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDDL() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table1 (x int, %s int)",
+                                "create table table2 (x int) partitioned by (%s string, q string)",
+                                "create table table3 (\n"
+                                        + "  a int,\n"
+                                        + "  %s struct<f1: boolean, f2: string, f3: struct<f4: int, f5: double>, f6: int>\n"
+                                        + ")"));
+        Random random = new Random();
+        for (String queryTemplate : toRun) {
+            // Select a random keyword.
+            String chosenKeyword =
+                    sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+            String finalQuery = String.format(queryTemplate, chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDQL() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table4(id int,name string,dep string,%s int,age int)",
+                                "select avg(%s) over (partition by dep) as avgsal from table4",
+                                "select dep,name,%s from (select dep,name,%s,rank() over "
+                                        + "(partition by dep order by %s desc) as rnk from table4) a where rnk=1",
+                                "select %s,sum(cnt) over (order by %s)/sum(cnt) over "
+                                        + "(order by %s ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) from"
+                                        + " (select %s,count(*) as cnt from table4 group by %s) a"));
+        Random random = new Random();
+        // Select a random keyword.
+        String chosenKeyword =
+                sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+        for (String queryTemplate : toRun) {
+            String finalQuery = queryTemplate.replace("%s", chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDML() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table5 (%s string, value string)",
+                                "create table table6(key int, ten int, one int, value string)",
+                                "from table5 insert overwrite table table6 map table5.%s,"
+                                        + " CAST(table5.%s / 10 AS INT), CAST(table5.%s % 10 AS INT),"
+                                        + " table5.value using 'cat' as (tkey, ten, one, tvalue)"
+                                        + " distribute by tvalue, tkey"));
+        Random random = new Random();
+        // Select a random keyword.
+        String chosenKeyword =
+                sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+        for (String queryTemplate : toRun) {
+            String finalQuery = queryTemplate.replace("%s", chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    private void runQuery(String query) {
+        try {
+            CollectionUtil.iteratorToList(tableEnv.executeSql(query).collect());
+        } catch (Exception e) {
+            System.out.println("Failed to run " + query);
+            throw e;
+        }

Review Comment:
   Can we assert this run without error?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia merged PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#issuecomment-2081434598

   Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#issuecomment-2120403078

   > Thanks for the update, +1 for merging.
   > 
   > It seems that the CI failure is unrelated, @luoyuxia could you please help confirming this?
   
   Yeah. I think the CI failure is unrelated. But I think we should first fix the CI failure before we merge it to avoid error diverge. Since the Ci failure is introudce by FLINK-29114. At first glance,  I think we can fix it in this pr by the way. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1611568586


##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {

Review Comment:
   I have renamed it.



##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1602576000


##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserConstants.java:
##########
@@ -30,4 +30,6 @@ public class HiveParserConstants {
     /* Constants for insert overwrite directory */
     public static final String IS_INSERT_DIRECTORY = "is-insert-directory";
     public static final String IS_TO_LOCAL_DIRECTORY = "is-to-local-directory";
+    public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME =

Review Comment:
   ```suggestion
       public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS =
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#issuecomment-2126933902

   @luoyuxia I've updated the pull request. PTAL.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#issuecomment-2126952619

   It seems that the test is canceled. Could you help me trigger it again? @luoyuxia 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#issuecomment-2128322457

   Awesome work, congrats on your first merged pull request!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1602581492


##########
flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParserConstants.java:
##########
@@ -30,4 +30,6 @@ public class HiveParserConstants {
     /* Constants for insert overwrite directory */
     public static final String IS_INSERT_DIRECTORY = "is-insert-directory";
     public static final String IS_TO_LOCAL_DIRECTORY = "is-to-local-directory";
+    public static final String SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME =

Review Comment:
   This name confused me indeed. It makes me think that this configuration option is used to control whether sql11 reserved keywords are allowed as identifier.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1606184637


##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);

Review Comment:
   This statement is unnecessary indeed. Removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1606184227


##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);
+        sql11ReservedKeywords =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "ALL",
+                                "ALTER",
+                                "ARRAY",
+                                "AS",
+                                "AUTHORIZATION",
+                                "BETWEEN",
+                                "BIGINT",
+                                "BINARY",
+                                "BOOLEAN",
+                                "BOTH",
+                                "BY",
+                                "CREATE",
+                                "CUBE",
+                                "CURRENT_DATE",
+                                "CURRENT_TIMESTAMP",
+                                "CURSOR",
+                                "DATE",
+                                "DECIMAL",
+                                "DELETE",
+                                "DESCRIBE",
+                                "DOUBLE",
+                                "DROP",
+                                "EXISTS",
+                                "EXTERNAL",
+                                "FALSE",
+                                "FETCH",
+                                "FLOAT",
+                                "FOR",
+                                "FULL",
+                                "GRANT",
+                                "GROUP",
+                                "GROUPING",
+                                "IMPORT",
+                                "IN",
+                                "INNER",
+                                "INSERT",
+                                "INT",
+                                "INTERSECT",
+                                "INTO",
+                                "IS",
+                                "LATERAL",
+                                "LEFT",
+                                "LIKE",
+                                "LOCAL",
+                                "NONE",
+                                "NULL",
+                                "OF",
+                                "ORDER",
+                                "OUT",
+                                "OUTER",
+                                "PARTITION",
+                                "PERCENT",
+                                "PROCEDURE",
+                                "RANGE",
+                                "READS",
+                                "REVOKE",
+                                "RIGHT",
+                                "ROLLUP",
+                                "ROW",
+                                "ROWS",
+                                "SET",
+                                "SMALLINT",
+                                "TABLE",
+                                "TIMESTAMP",
+                                "TO",
+                                "TRIGGER",
+                                "TRUE",
+                                "TRUNCATE",
+                                "UNION",
+                                "UPDATE",
+                                "USER",
+                                "USING",
+                                "VALUES",
+                                "WITH",
+                                "REGEXP",
+                                "RLIKE",
+                                "PRIMARY",
+                                "FOREIGN",
+                                "CONSTRAINT",
+                                "REFERENCES",
+                                "PRECISION"));
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDDL() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table1 (x int, %s int)",
+                                "create table table2 (x int) partitioned by (%s string, q string)",
+                                "create table table3 (\n"
+                                        + "  a int,\n"
+                                        + "  %s struct<f1: boolean, f2: string, f3: struct<f4: int, f5: double>, f6: int>\n"
+                                        + ")"));
+        Random random = new Random();
+        for (String queryTemplate : toRun) {
+            // Select a random keyword.
+            String chosenKeyword =
+                    sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+            String finalQuery = String.format(queryTemplate, chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDQL() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table4(id int,name string,dep string,%s int,age int)",
+                                "select avg(%s) over (partition by dep) as avgsal from table4",
+                                "select dep,name,%s from (select dep,name,%s,rank() over "
+                                        + "(partition by dep order by %s desc) as rnk from table4) a where rnk=1",
+                                "select %s,sum(cnt) over (order by %s)/sum(cnt) over "
+                                        + "(order by %s ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) from"
+                                        + " (select %s,count(*) as cnt from table4 group by %s) a"));
+        Random random = new Random();
+        // Select a random keyword.
+        String chosenKeyword =
+                sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+        for (String queryTemplate : toRun) {
+            String finalQuery = queryTemplate.replace("%s", chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    @Test
+    void testReservedKeywordAsIdentifierInDML() {
+        List<String> toRun =
+                new ArrayList<>(
+                        Arrays.asList(
+                                "create table table5 (%s string, value string)",
+                                "create table table6(key int, ten int, one int, value string)",
+                                "from table5 insert overwrite table table6 map table5.%s,"
+                                        + " CAST(table5.%s / 10 AS INT), CAST(table5.%s % 10 AS INT),"
+                                        + " table5.value using 'cat' as (tkey, ten, one, tvalue)"
+                                        + " distribute by tvalue, tkey"));
+        Random random = new Random();
+        // Select a random keyword.
+        String chosenKeyword =
+                sql11ReservedKeywords.get(random.nextInt(sql11ReservedKeywords.size()));
+        for (String queryTemplate : toRun) {
+            String finalQuery = queryTemplate.replace("%s", chosenKeyword);
+            runQuery(finalQuery);
+        }
+    }
+
+    private void runQuery(String query) {
+        try {
+            CollectionUtil.iteratorToList(tableEnv.executeSql(query).collect());
+        } catch (Exception e) {
+            System.out.println("Failed to run " + query);
+            throw e;
+        }

Review Comment:
   I've replace it with `assertThatNoException()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-35221][hive] Support SQL 2011 reserved keywords as identifiers in HiveParser [flink-connector-hive]

Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #18:
URL: https://github.com/apache/flink-connector-hive/pull/18#discussion_r1606183796


##########
flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.flink.connectors.hive;
+
+import org.apache.flink.configuration.BatchExecutionOptions;
+import org.apache.flink.table.api.SqlDialect;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.catalog.hive.HiveTestUtils;
+import org.apache.flink.table.module.CoreModule;
+import org.apache.flink.table.module.hive.HiveModule;
+import org.apache.flink.table.planner.delegation.hive.HiveParserConstants;
+import org.apache.flink.util.CollectionUtil;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/** Test the compatibility with SQL11 reserved keywords in hive queries. */
+class HiveDialectSupportSQL11ReservedKeywordAsIdentifierTest {
+    private static HiveCatalog hiveCatalog;
+    private static TableEnvironment tableEnv;
+    private static List<String> sql11ReservedKeywords;
+
+    @BeforeAll
+    static void setup() throws Exception {
+        hiveCatalog = HiveTestUtils.createHiveCatalog();
+        hiveCatalog
+                .getHiveConf()
+                .setBoolean(
+                        HiveParserConstants
+                                .SUPPORT_SQL11_RESERVED_KEYWORDS_AS_IDENTIFIERS_CONFIG_NAME,
+                        false);
+        hiveCatalog.open();
+        tableEnv = getTableEnvWithHiveCatalog();
+        tableEnv.getConfig().set(BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_ENABLED, false);
+        sql11ReservedKeywords =
+                new ArrayList<>(
+                        Arrays.asList(

Review Comment:
   It's unnecessary indeed. Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org