public double getRowCount(DrillLimitRelBase rel, RelMetadataQuery mq) { return rel.estimateRowCount(mq); }
@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 RelWriter explainTerms(RelWriter pw) { super.explainTerms(pw); pw.itemIf("partitioned", isPartitioned, isPartitioned); return pw; }
@Override public double estimateRowCount(RelMetadataQuery mq) { int off = offset != null? RexLiteral.intValue(offset): 0; if (fetch == null) { // If estimated rowcount is less than offset return 0 return Math.max(0, getInput().estimateRowCount(mq) - off); } else { int f = RexLiteral.intValue(fetch); return off + f; } }