lirui-apache commented on a change in pull request #12656:
URL: https://github.com/apache/flink/pull/12656#discussion_r440135489



##########
File path: 
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/TableEnvHiveConnectorITCase.java
##########
@@ -669,6 +669,18 @@ public void testNonExistingPartitionFolder() throws 
Exception {
                }
        }
 
+       @Test
+       public void testInsertPartitionWithStarSource() throws Exception {
+               hiveShell.execute("create table src (x int,y string)");
+               hiveShell.insertInto("default", "src").addRow(1, "a").commit();
+               hiveShell.execute("create table dest (x int) partitioned by (p1 
int,p2 string)");
+               TableEnvironment tableEnv = getTableEnvWithHiveCatalog();

Review comment:
       ```suggestion
                TableEnvironment tableEnv = getTableEnvWithHiveCatalog();
                tableEnv.executeSql("create table src (x int,y string)");
                HiveTestUtils.createTextTableInserter(hiveShell, "default", 
"src").addRow(new Object[]{1, "a"}).commit();
                tableEnv.executeSql("create table dest (x int) partitioned by 
(p1 int,p2 string)");
   ```

##########
File path: 
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/TableEnvHiveConnectorITCase.java
##########
@@ -669,6 +669,18 @@ public void testNonExistingPartitionFolder() throws 
Exception {
                }
        }
 
+       @Test
+       public void testInsertPartitionWithStarSource() throws Exception {
+               hiveShell.execute("create table src (x int,y string)");
+               hiveShell.insertInto("default", "src").addRow(1, "a").commit();
+               hiveShell.execute("create table dest (x int) partitioned by (p1 
int,p2 string)");
+               TableEnvironment tableEnv = getTableEnvWithHiveCatalog();
+               TableEnvUtil.execInsertSqlAndWaitResult(tableEnv,
+                               "insert into dest partition (p1=1) select * 
from src");
+               List<Row> results = 
Lists.newArrayList(tableEnv.sqlQuery("select * from dest").execute().collect());
+               assertEquals("[1,1,a]", results.toString());

Review comment:
       Need to drop table `src` and `dest` after the test, because the catalog 
is reused across all test cases. And you can just use `tableEnv` to execute 
DDLs -- it's using the hive dialect




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