lirui-apache commented on a change in pull request #9342: [FLINK-13438][hive] 
Fix DataTypes.DATE/TIME/TIMESTAMP support for hive connectors
URL: https://github.com/apache/flink/pull/9342#discussion_r314155004
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/TableEnvHiveConnectorTest.java
 ##########
 @@ -165,6 +184,77 @@ public void testDecimal() throws Exception {
                }
        }
 
+       /**
+        * This test is to check whether data can successfully flow from hive 
source
+        * into flink system and then into hive sink.
+        * We especially want to test data types about date here.
+        *
+        * <p>TODO: Add timestamp test after fixing the timestamp support of 
hive connector.
+        */
+       @Test
+       public void testHiveSourceSink() throws Exception {
+               hiveShell.execute("CREATE DATABASE full_test_db");
+               hiveShell.execute("CREATE TABLE full_test_db.input_tbl (a INT, 
b STRING, c DOUBLE, d DATE)");
+               hiveShell.insertInto("full_test_db", "input_tbl")
+                       .withAllColumns()
+                       .addRow(1, "aaa", 1.1, Date.valueOf("2011-01-11"))
+                       .addRow(2, "bbb", 2.2, Date.valueOf("2012-02-12"))
+                       .addRow(3, "ccc", 3.3, Date.valueOf("2013-03-13"))
+                       .commit();
+               hiveShell.execute("CREATE TABLE full_test_db.output_tbl (a INT, 
b STRING, c DOUBLE, d DATE)");
+
+               TableSchema schema = TableSchema.builder()
+                       .field("a", DataTypes.INT())
+                       .field("b", DataTypes.STRING())
+                       .field("c", DataTypes.DOUBLE())
+                       .field("d", DataTypes.DATE())
+                       .build();
+
+               ObjectPath sourcePath = new ObjectPath("full_test_db", 
"input_tbl");
+               CatalogTable sourceTable1 = (CatalogTable) 
hiveCatalog.getTable(sourcePath);
+               HiveTableSource hiveTableSource1 = new HiveTableSource(new 
JobConf(hiveConf), sourcePath, sourceTable1);
 
 Review comment:
   I don't think we still need to manually create source and sink in the tests. 
Similar to other test cases in this class, we can just use sql.

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


With regards,
Apache Git Services

Reply via email to