Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/2923#discussion_r91081832 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/nodes/dataset/BatchScan.scala --- @@ -45,7 +45,8 @@ abstract class BatchScan( override def computeSelfCost (planner: RelOptPlanner, metadata: RelMetadataQuery): RelOptCost = { val rowCnt = metadata.getRowCount(this) - planner.getCostFactory.makeCost(rowCnt, rowCnt, 0) + val columnCnt = getRowType.getFieldCount --- End diff -- The first cost parameter is number of processed rows, second parameter indicates CPU cost, and third IO cost. I would not change the number of processed rows but add IO costs of `rowCnt * rowSize` where `rowSize` can be computed by `DataSetRel.estimateRowSize()`. Have a look at `DataSetCost` to check how costs are compared. The cost model aims at minimizing IO costs. So making here a difference results in the choice of the plan with the most projection.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---