wuchong commented on a change in pull request #15050:
URL: https://github.com/apache/flink/pull/15050#discussion_r588080011



##########
File path: 
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
##########
@@ -99,6 +104,20 @@ public void tearDown() {
         }
     }
 
+    @Test
+    public void testPluggableParser() {
+        TableEnvironmentInternal tableEnvInternal = (TableEnvironmentInternal) 
tableEnv;
+        Parser parser = tableEnvInternal.getParser();
+        // hive dialect should use HiveParser
+        assertTrue(parser instanceof HiveParser);
+        // execute some sql and verify the parser instance is reused
+        tableEnvInternal.executeSql("show databases");
+        assertSame(parser, tableEnvInternal.getParser());
+        // switching dialect will result in a new parser
+        tableEnvInternal.getConfig().setSqlDialect(SqlDialect.DEFAULT);
+        assertNotSame(parser, tableEnvInternal.getParser());

Review comment:
       Could you assert the class name of the new parser? Asserting same object 
may not safe, because the underlying may return a new HiveParser instance. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to