twalthr commented on a change in pull request #8521: [FLINK-12601][table] Make 
the DataStream & DataSet conversion to a Table independent from Calcite
URL: https://github.com/apache/flink/pull/8521#discussion_r289278722
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/plan/TableOperationConverter.java
 ##########
 @@ -248,11 +255,41 @@ public RelNode visitCatalogTable(CatalogTableOperation 
catalogTable) {
                public RelNode visitOther(TableOperation other) {
                        if (other instanceof PlannerTableOperation) {
                                return ((PlannerTableOperation) 
other).getCalciteTree();
+                       } else if (other instanceof DataStreamTableOperation) {
+                               return 
convertToDataStreamScan((DataStreamTableOperation<?>) other);
+                       } else if (other instanceof DataSetTableOperation) {
+                               return 
convertToDataSetScan((DataSetTableOperation<?>) other);
                        }
 
                        throw new TableException("Unknown table operation: " + 
other);
                }
 
+               private RelNode 
convertToDataStreamScan(DataStreamTableOperation<?> tableOperation) {
+                       RelDataType logicalRowType = relBuilder.getTypeFactory()
+                               
.buildLogicalRowType(tableOperation.getTableSchema());
+                       RowSchema rowSchema = new RowSchema(logicalRowType);
+
+                       return new FlinkLogicalDataStreamScan(
+                               relBuilder.getCluster(),
+                               
relBuilder.getCluster().traitSet().replace(FlinkConventions.LOGICAL()),
+                               relBuilder.getRelOptSchema(),
+                               tableOperation.getDataStream(),
+                               tableOperation.getFieldIndices(),
+                               rowSchema);
+               }
+
+               private RelNode convertToDataSetScan(DataSetTableOperation<?> 
tableOperation) {
+                       RelDataType relDataType = relBuilder.getTypeFactory()
+                               
.buildLogicalRowType(tableOperation.getTableSchema());
+                       return new FlinkLogicalDataSetScan(
 
 Review comment:
   nit: add empty line an rename variable for consistency with upper method

----------------------------------------------------------------
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

Reply via email to