JingsongLi commented on a change in pull request #12281:
URL: https://github.com/apache/flink/pull/12281#discussion_r429813426
##########
File path:
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogUseBlinkITCase.java
##########
@@ -251,51 +252,53 @@ private void testUdf(boolean batch) throws Exception {
@Test
public void testTimestampUDF() throws Exception {
- hiveCatalog.createFunction(new ObjectPath("default", "myyear"),
- new
CatalogFunctionImpl(UDFYear.class.getCanonicalName()),
- false);
-
- hiveShell.execute("create table src(ts timestamp)");
+// hiveCatalog.createFunction(new ObjectPath("default", "myyear"),
+// new
CatalogFunctionImpl(UDFYear.class.getCanonicalName()),
+// false);
+
+ TableEnvironment tableEnv =
HiveTestUtils.createTableEnvWithBlinkPlannerBatchMode(SqlDialect.HIVE);
+ tableEnv.registerCatalog(hiveCatalog.getName(), hiveCatalog);
+ tableEnv.useCatalog(hiveCatalog.getName());
+ tableEnv.executeSql(String.format("create function myyear as
'%s'", UDFYear.class.getName()));
+ tableEnv.executeSql("create table src(ts timestamp)");
try {
HiveTestUtils.createTextTableInserter(hiveShell,
"default", "src")
.addRow(new
Object[]{Timestamp.valueOf("2013-07-15 10:00:00")})
.addRow(new
Object[]{Timestamp.valueOf("2019-05-23 17:32:55")})
.commit();
- TableEnvironment tableEnv =
HiveTestUtils.createTableEnvWithBlinkPlannerBatchMode();
- tableEnv.registerCatalog(hiveCatalog.getName(),
hiveCatalog);
- tableEnv.useCatalog(hiveCatalog.getName());
List<Row> results = Lists.newArrayList(
tableEnv.sqlQuery("select myyear(ts) as
y from src").execute().collect());
Assert.assertEquals(2, results.size());
Assert.assertEquals("[2013, 2019]", results.toString());
} finally {
- hiveShell.execute("drop table src");
+ tableEnv.executeSql("drop table src");
}
}
@Test
public void testDateUDF() throws Exception {
- hiveCatalog.createFunction(new ObjectPath("default", "mymonth"),
- new
CatalogFunctionImpl(UDFMonth.class.getCanonicalName()),
- false);
-
- hiveShell.execute("create table src(dt date)");
+// hiveCatalog.createFunction(new ObjectPath("default", "mymonth"),
Review comment:
Ditto?
##########
File path:
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/catalog/hive/HiveCatalogUseBlinkITCase.java
##########
@@ -251,51 +252,53 @@ private void testUdf(boolean batch) throws Exception {
@Test
public void testTimestampUDF() throws Exception {
- hiveCatalog.createFunction(new ObjectPath("default", "myyear"),
- new
CatalogFunctionImpl(UDFYear.class.getCanonicalName()),
- false);
-
- hiveShell.execute("create table src(ts timestamp)");
+// hiveCatalog.createFunction(new ObjectPath("default", "myyear"),
Review comment:
Delete it?
----------------------------------------------------------------
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]