You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Bowen Li (Jira)" <ji...@apache.org> on 2019/12/13 20:20:00 UTC

[jira] [Created] (FLINK-15256) unable to drop table in HiveCatalogITCase

Bowen Li created FLINK-15256:
--------------------------------

             Summary: unable to drop table in HiveCatalogITCase
                 Key: FLINK-15256
                 URL: https://issues.apache.org/jira/browse/FLINK-15256
             Project: Flink
          Issue Type: Bug
          Components: Connectors / Hive
            Reporter: Bowen Li
            Assignee: Terry Wang
             Fix For: 1.10.0, 1.11.0



{code:java}
@Test
	public void testCsvTableViaSQL() throws Exception {
		EnvironmentSettings settings = EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build();
		TableEnvironment tableEnv = TableEnvironment.create(settings);

		tableEnv.registerCatalog("myhive", hiveCatalog);
		tableEnv.useCatalog("myhive");

		String path = this.getClass().getResource("/csv/test.csv").getPath();

		tableEnv.sqlUpdate("create table test2 (name String, age Int) with (\n" +
			"   'connector.type' = 'filesystem',\n" +
			"   'connector.path' = 'file://" + path + "',\n" +
			"   'format.type' = 'csv'\n" +
			")");

		Table t = tableEnv.sqlQuery("SELECT * FROM myhive.`default`.test2");

		List<Row> result = TableUtils.collectToList(t);

		// assert query result
		assertEquals(
			new HashSet<>(Arrays.asList(
				Row.of("1", 1),
				Row.of("2", 2),
				Row.of("3", 3))),
			new HashSet<>(result)
		);

		tableEnv.sqlUpdate("drop table myhive.`default`.tests2");
	}
{code}

The last drop table statement reports error as:


{code:java}
org.apache.flink.table.api.ValidationException: Could not execute DropTable in path `myhive`.`default`.`tests2`

	at org.apache.flink.table.catalog.CatalogManager.execute(CatalogManager.java:568)
	at org.apache.flink.table.catalog.CatalogManager.dropTable(CatalogManager.java:543)
	at org.apache.flink.table.api.internal.TableEnvironmentImpl.sqlUpdate(TableEnvironmentImpl.java:519)
	at org.apache.flink.table.catalog.hive.HiveCatalogITCase.testCsvTableViaSQL(HiveCatalogITCase.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.apache.flink.connectors.hive.FlinkStandaloneHiveRunner.runTestMethod(FlinkStandaloneHiveRunner.java:169)
	at org.apache.flink.connectors.hive.FlinkStandaloneHiveRunner.runChild(FlinkStandaloneHiveRunner.java:154)
	at org.apache.flink.connectors.hive.FlinkStandaloneHiveRunner.runChild(FlinkStandaloneHiveRunner.java:92)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.flink.table.catalog.exceptions.TableNotExistException: Table (or view) default.tests2 does not exist in Catalog test-catalog.
	at org.apache.flink.table.catalog.hive.HiveCatalog.dropTable(HiveCatalog.java:449)
	at org.apache.flink.table.catalog.CatalogManager.lambda$dropTable$14(CatalogManager.java:544)
	at org.apache.flink.table.catalog.CatalogManager.execute(CatalogManager.java:566)
	... 33 more

OK

{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)