@Override protected Object clone() throws CloneNotSupportedException { return new DirectScanPrel(this.getCluster(), this.getTraitSet(), getCopy(this.getGroupScan()), this.rowType); }
@Override public double estimateRowCount(RelMetadataQuery mq) { final PlannerSettings settings = PrelUtil.getPlannerSettings(getCluster()); double rowCount = this.getGroupScan().getScanStats(settings).getRecordCount(); logger.debug("#{}.estimateRowCount get rowCount {} from groupscan {}", this.getId(), rowCount, System.identityHashCode(this.getGroupScan())); return rowCount; }
@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new DirectScanPrel(this.getCluster(), traitSet, this.getGroupScan(), this.rowType); }
@Override public RelOptCost computeSelfCost(final RelOptPlanner planner, RelMetadataQuery mq) { final PlannerSettings settings = PrelUtil.getPlannerSettings(planner); final ScanStats stats = this.getGroupScan().getScanStats(settings); final int columnCount = this.getRowType().getFieldCount(); if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return planner.getCostFactory().makeCost(stats.getRecordCount() * columnCount, stats.getCpuCost(), stats.getDiskCost()); } double rowCount = stats.getRecordCount(); double cpuCost = rowCount * Math.max(columnCount, 1); if (stats.getCpuCost() > 0) { cpuCost *= stats.getCpuCost(); } double ioCost = stats.getDiskCost(); DrillCostBase.DrillCostFactory costFactory = (DrillCostBase.DrillCostFactory)planner.getCostFactory(); return costFactory.makeCost(rowCount, cpuCost, ioCost, 0); }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { return creator.addMetadata(this, this.getGroupScan()); }
@Override public void onMatch(RelOptRuleCall call) { final DrillDirectScanRel scan = call.rel(0); final RelTraitSet traits = scan.getTraitSet().plus(Prel.DRILL_PHYSICAL); final DirectScanPrel newScan = new DirectScanPrel(scan.getCluster(), traits, scan.getGroupScan(), scan.getRowType()); call.transformTo(newScan); call.transformTo(newScan); } }
@Override public DistributionAffinity getDistributionAffinity() { return this.getGroupScan().getDistributionAffinity(); }
final GroupScan directScan = new MetadataDirectGroupScan(reader, oldGrpScan.getFiles(), scanStats); final DirectScanPrel newScan = new DirectScanPrel(scan.getCluster(), scan.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON), directScan, scanRowType);
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw).item("groupscan", this.getGroupScan().getDigest()); }