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_r295561400
 
 

 ##########
 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:
   nice, I didn't know map() can be applied to Optional objects

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to