use of org.apache.flink.table.planner.delegation.hive.HiveParser in project flink by apache.
the class HiveDialectITCase method testParseCommand.
@Test
public void testParseCommand() {
TableEnvironmentInternal tableEnvInternal = (TableEnvironmentInternal) tableEnv;
Parser parser = tableEnvInternal.getParser();
// hive dialect should use HiveParser
assertTrue(parser instanceof HiveParser);
assertThat(parser.parse("HELP").get(0), instanceOf(HelpOperation.class));
assertThat(parser.parse("clear").get(0), instanceOf(ClearOperation.class));
assertThat(parser.parse("SET").get(0), instanceOf(SetOperation.class));
assertThat(parser.parse("ResET").get(0), instanceOf(ResetOperation.class));
assertThat(parser.parse("Exit").get(0), instanceOf(QuitOperation.class));
}
use of org.apache.flink.table.planner.delegation.hive.HiveParser in project flink by apache.
the class HiveDialectITCase method testPluggableParser.
@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);
assertNotEquals(parser.getClass().getName(), tableEnvInternal.getParser().getClass().getName());
}
Aggregations