leesf commented on a change in pull request #2900:
URL: https://github.com/apache/hudi/pull/2900#discussion_r623979619
##########
File path:
hudi-flink/src/test/java/org/apache/hudi/table/HoodieDataSourceITCase.java
##########
@@ -390,6 +392,26 @@ void testWriteNonPartitionedTable(ExecMode execMode) {
assertRowsEquals(result, "[id1,Sophia,18,1970-01-01T00:00:05,par5]");
}
+ @ParameterizedTest
+ @EnumSource(value = ExecMode.class)
+ void testStreamReadEmptyTablePath(ExecMode execMode) throws Exception {
+ // create an empty table
+ Configuration conf =
TestConfigurations.getDefaultConf(tempFile.getAbsolutePath());
+ StreamerUtil.initTableIfNotExists(conf);
+
+ // create a flink source table
+ Map<String, String> options = new HashMap<>();
+ options.put(FlinkOptions.PATH.key(), tempFile.getAbsolutePath());
+ options.put(FlinkOptions.READ_AS_STREAMING.key(), "true");
+ options.put(FlinkOptions.TABLE_TYPE.key(),
FlinkOptions.TABLE_TYPE_MERGE_ON_READ);
+ String createHoodieTable =
TestConfigurations.getCreateHoodieTableDDL("t1", options);
+ streamTableEnv.executeSql(createHoodieTable);
+
+ // execute query and assert throws exception
+ assertThrows(HoodieException.class, () -> execSelectSql(streamTableEnv,
"select * from t1", 10), "No successful commits under path " +
tempFile.getAbsolutePath());
Review comment:
nit: pls split into two lines for better readability and else looks good
to me.
##########
File path:
hudi-flink/src/test/java/org/apache/hudi/table/HoodieDataSourceITCase.java
##########
@@ -390,6 +392,26 @@ void testWriteNonPartitionedTable(ExecMode execMode) {
assertRowsEquals(result, "[id1,Sophia,18,1970-01-01T00:00:05,par5]");
}
+ @ParameterizedTest
+ @EnumSource(value = ExecMode.class)
+ void testStreamReadEmptyTablePath(ExecMode execMode) throws Exception {
+ // create an empty table
+ Configuration conf =
TestConfigurations.getDefaultConf(tempFile.getAbsolutePath());
+ StreamerUtil.initTableIfNotExists(conf);
+
+ // create a flink source table
+ Map<String, String> options = new HashMap<>();
+ options.put(FlinkOptions.PATH.key(), tempFile.getAbsolutePath());
+ options.put(FlinkOptions.READ_AS_STREAMING.key(), "true");
+ options.put(FlinkOptions.TABLE_TYPE.key(),
FlinkOptions.TABLE_TYPE_MERGE_ON_READ);
+ String createHoodieTable =
TestConfigurations.getCreateHoodieTableDDL("t1", options);
+ streamTableEnv.executeSql(createHoodieTable);
+
+ // execute query and assert throws exception
+ assertThrows(HoodieException.class, () -> execSelectSql(streamTableEnv,
"select * from t1", 10), "No successful commits under path " +
tempFile.getAbsolutePath());
Review comment:
pls split into two lines for better readability and else looks good to
me.
--
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]