xuefuz 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_r295537393
##########
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:
map() is applied to an Optional object, so the key (tf) is a TableFactory
instance.
As you can see from other types of tables, calcite seems only need
TableSource.
If tableFactory isn't present, then orElse() clause kicks in. The test
verifies that.
----------------------------------------------------------------
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