bowenli86 commented on a change in pull request #8785: [FLINK-11480][hive]
Create HiveTableFactory that creates TableSource/…
URL: https://github.com/apache/flink/pull/8785#discussion_r295067658
##########
File path:
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/catalog/DatabaseCalciteSchema.java
##########
@@ -77,6 +84,23 @@ public Table getTable(String tableName) {
!connectorTable.isBatch(),
FlinkStatistic.of(tableSource.getTableStats().orElse(null))))
.orElseThrow(() -> new
TableException("Cannot query a sink only table."));
+ } else if (table instanceof CatalogTable) {
+ Optional<TableFactory> tableFactory =
catalog.getTableFactory();
+ TableSource<Row> tableSource =
tableFactory.map(tf -> ((TableSourceFactory)
tf).createTableSource((CatalogTable) table))
Review comment:
the `tf` in `.map(tf -> xxx)` is an Optional object and cannot be casted to
`TableSourceFactory`, right?
BTW, what happens if the `tableFactory` is not present? Also, maybe I missed
it - I only find table source, what about table sink?
----------------------------------------------------------------
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