/// TODO: this method is same as the one for ScanPrel...eventually we should consolidate
/// this and few other methods in a common base class which would be extended
/// by both logical and physical rels.
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner) {
ScanStats stats = this.groupScan.getScanStats();
int columnCount = this.getRowType().getFieldCount();
if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
return planner.getCostFactory().makeCost(stats.getRecordCount() * columnCount, stats.getCpuCost(), stats.getDiskCost());
}
// double rowCount = RelMetadataQuery.getRowCount(this);
double rowCount = stats.getRecordCount();
double cpuCost = rowCount * columnCount; // for now, assume cpu cost is proportional to row count.
// Even though scan is reading from disk, in the currently generated plans all plans will
// need to read the same amount of data, so keeping the disk io cost 0 is ok for now.
// In the future we might consider alternative scans that go against projections or