You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by bl...@apache.org on 2019/12/16 05:14:43 UTC

[flink] branch release-1.10 updated: [hotfix][hive][test] enhance HiveCatalog IT case with 'alter table' and 'drop table' statements

This is an automated email from the ASF dual-hosted git repository.

bli pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.10 by this push:
     new f562fac  [hotfix][hive][test] enhance HiveCatalog IT case with 'alter table' and 'drop table' statements
f562fac is described below

commit f562facedcd0fd5572ecea368bfd84db53c6c8f6
Author: bowen.li <bo...@gmail.com>
AuthorDate: Sun Dec 15 20:38:03 2019 -0800

    [hotfix][hive][test] enhance HiveCatalog IT case with 'alter table' and 'drop table' statements
---
 .../flink/table/catalog/hive/HiveCatalogITCase.java | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogITCase.java b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogITCase.java
index 91aa6eb..5ad1769 100644
--- a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogITCase.java
+++ b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogITCase.java
@@ -119,6 +119,23 @@ public class HiveCatalogITCase {
 				Row.of("3", 3))),
 			new HashSet<>(result)
 		);
+
+		tableEnv.sqlUpdate("ALTER TABLE test2 RENAME TO newtable");
+
+		t = tableEnv.sqlQuery("SELECT * FROM myhive.`default`.newtable");
+
+		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 newtable");
 	}
 
 	@Test
@@ -127,6 +144,7 @@ public class HiveCatalogITCase {
 		BatchTableEnvironment tableEnv = BatchTableEnvironment.create(execEnv);
 
 		tableEnv.registerCatalog("myhive", hiveCatalog);
+		tableEnv.useCatalog("myhive");
 
 		TableSchema schema = TableSchema.builder()
 			.field("name", DataTypes.STRING())
@@ -200,5 +218,8 @@ public class HiveCatalogITCase {
 
 		// No more line
 		assertNull(reader.readLine());
+
+		tableEnv.sqlUpdate(String.format("DROP TABLE %s", sourceTableName));
+		tableEnv.sqlUpdate(String.format("DROP TABLE %s", sinkTableName));
 	}
 }