&& !condition.isAlwaysTrue()) { RexBuilder builder = scanRel.getCluster().getRexBuilder(); PlannerSettings settings = PrelUtil.getSettings(scanRel.getCluster()); String conditionAsStr = convertRexToString(condition, scanRel.getRowType()); if (statsCache.get(conditionAsStr) == null
double forcedScalingFactor = PrelUtil.getSettings(scanRel.getCluster()).getIndexStatsRowCountScalingFactor();
PlannerSettings settings = PrelUtil.getSettings(scanRel.getCluster());
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) { return childPOP; } UnionExchange g = new UnionExchange(childPOP); return creator.addMetadata(this, g); }
public static RelNode convert(RelNode rel, RelTraitSet toTraits) { toTraits = toTraits.simplify(); PlannerSettings settings = PrelUtil.getSettings(rel.getCluster()); if(settings.isSingleMode()){ toTraits = toTraits.replace(DrillDistributionTrait.ANY); } return RelOptRule.convert(rel, toTraits.simplify()); }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) { return childPOP; } RangePartitionExchange g = new RangePartitionExchange(childPOP, partitionFunction); return creator.addMetadata(this, g); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } double numRows = estimateRowCount(mq); double cpuCost = DrillCostBase.COMPARE_CPU_COST * numRows; DrillCostFactory costFactory = (DrillCostFactory)planner.getCostFactory(); return costFactory.makeCost(numRows, cpuCost, 0, 0); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } if (joincategory == JoinCategory.CARTESIAN || joincategory == JoinCategory.INEQUALITY) { return planner.getCostFactory().makeInfiniteCost(); } return computeHashJoinCost(planner, mq); }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); org.apache.drill.exec.physical.config.Project p = new org.apache.drill.exec.physical.config.Project( this.getProjectExpressions(new DrillParseContext(PrelUtil.getSettings(getCluster()))), childPOP, outputProj); return creator.addMetadata(this, p); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } // by default, assume cost is proportional to number of rows double rowCount = mq.getRowCount(this); DrillCostFactory costFactory = (DrillCostFactory)planner.getCostFactory(); return costFactory.makeCost(rowCount, rowCount, 0, 0).multiplyBy(0.1); }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); Project p = new Project(this.getProjectExpressions(new DrillParseContext(PrelUtil.getSettings(getCluster()))), childPOP, outputProj); return creator.addMetadata(this, p); }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); Filter p = new Filter(childPOP, getFilterExpression(new DrillParseContext(PrelUtil.getSettings(getCluster()))), 1.0f); return creator.addMetadata(this, p); }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); FlattenPOP f = new FlattenPOP(childPOP, (SchemaPath) getFlattenExpression(new DrillParseContext(PrelUtil.getSettings(getCluster())))); return creator.addMetadata(this, f); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner).multiplyBy(.1); } double rowCount = mq.getRowCount(this.getRight()); DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory(); // RowKeyJoin operator by itself incurs negligible CPU and I/O cost since it is not doing a real join. // The actual cost is attributed to the skip-scan (random I/O). The RK join will hold 1 batch in memory but // it is not making any extra copy of either the left or right batches, so the memory cost is 0 return costFactory.makeCost(rowCount, 0, 0, 0, 0); }
protected boolean checkBroadcastConditions(RelOptPlanner planner, DrillJoin join, RelNode left, RelNode right) { double estimatedRightRowCount = RelMetadataQuery.instance().getRowCount(right); if (estimatedRightRowCount < PrelUtil.getSettings(join.getCluster()).getBroadcastThreshold() && ! left.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE).equals(DrillDistributionTrait.SINGLETON) && (join.getJoinType() == JoinRelType.INNER || join.getJoinType() == JoinRelType.LEFT) ) { return true; } return false; }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) { return childPOP; } SingleMergeExchange g = new SingleMergeExchange(childPOP, PrelUtil.getOrdering(this.collation, getInput().getRowType())); return creator.addMetadata(this, g); }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) { return childPOP; } // TODO - refactor to different exchange name HashToRandomExchange g = new HashToRandomExchange(childPOP, HashPrelUtil.getHashExpression(this.fields, getInput().getRowType())); return creator.addMetadata(this, g); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } RelNode child = this.getInput(); double inputRows = mq.getRowCount(child); double cpuCost = estimateCpuCost(mq); DrillCostFactory costFactory = (DrillCostFactory)planner.getCostFactory(); return costFactory.makeCost(inputRows, cpuCost, 0, 0); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } RelNode child = this.getInput(); double inputRows = mq.getRowCount(child); int rowWidth = child.getRowType().getFieldCount() * DrillCostBase.AVG_FIELD_WIDTH; double rangePartitionCpuCost = DrillCostBase.RANGE_PARTITION_CPU_COST * inputRows; double svrCpuCost = DrillCostBase.SVR_CPU_COST * inputRows; double networkCost = DrillCostBase.BYTE_NETWORK_COST * inputRows * rowWidth; DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory(); return costFactory.makeCost(inputRows, rangePartitionCpuCost + svrCpuCost, 0, networkCost); }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) { return childPOP; } HashToMergeExchange g = new HashToMergeExchange(childPOP, HashPrelUtil.getHashExpression(this.distFields, getInput().getRowType()), PrelUtil.getOrdering(this.collation, getInput().getRowType())); return creator.addMetadata(this, g); }