aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java
diff options
context:
space:
mode:
authorJacques Nadeau <jacques@apache.org>2015-05-09 11:20:47 -0700
committerJacques Nadeau <jacques@apache.org>2015-05-10 09:24:21 -0700
commit5de7d6e9059f5877b4bd368ab12022e47a74baa6 (patch)
tree9f7359333997732176ebaae5ab63bd274452ed6a /exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java
parentfb5e455c77b720bb2f350acf5cd535ffd612c671 (diff)
DRILL-2723: Add option to change text format row size estimate.
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java
index a724e2354..9a009ce96 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java
@@ -29,6 +29,7 @@ import org.apache.drill.exec.physical.base.GroupScan;
import org.apache.drill.exec.physical.base.ScanStats;
import org.apache.drill.exec.planner.common.DrillScanRelBase;
import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory;
+import org.apache.drill.exec.planner.physical.PlannerSettings;
import org.apache.drill.exec.planner.physical.PrelUtil;
import org.apache.drill.exec.planner.torel.ConversionContext;
import org.apache.calcite.rel.RelWriter;
@@ -52,19 +53,22 @@ public class DrillScanRel extends DrillScanRelBase implements DrillRel {
final private RelDataType rowType;
private GroupScan groupScan;
private List<SchemaPath> columns;
+ private PlannerSettings settings;
/** Creates a DrillScan. */
- public DrillScanRel(RelOptCluster cluster, RelTraitSet traits,
- RelOptTable table) {
+ public DrillScanRel(final RelOptCluster cluster, final RelTraitSet traits,
+ final RelOptTable table) {
// By default, scan does not support project pushdown.
// Decision whether push projects into scan will be made solely in DrillPushProjIntoScanRule.
this(cluster, traits, table, table.getRowType(), GroupScan.ALL_COLUMNS);
+ this.settings = PrelUtil.getPlannerSettings(cluster.getPlanner());
}
/** Creates a DrillScan. */
- public DrillScanRel(RelOptCluster cluster, RelTraitSet traits,
- RelOptTable table, RelDataType rowType, List<SchemaPath> columns) {
+ public DrillScanRel(final RelOptCluster cluster, final RelTraitSet traits,
+ final RelOptTable table, final RelDataType rowType, final List<SchemaPath> columns) {
super(DRILL_LOGICAL, cluster, traits, table);
+ this.settings = PrelUtil.getPlannerSettings(cluster.getPlanner());
this.rowType = rowType;
if (columns == null) { // planner asks to scan all of the columns
this.columns = ColumnList.all();
@@ -75,18 +79,19 @@ public class DrillScanRel extends DrillScanRelBase implements DrillRel {
}
try {
this.groupScan = drillTable.getGroupScan().clone(this.columns);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new DrillRuntimeException("Failure creating scan.", e);
}
}
/** Creates a DrillScanRel for a particular GroupScan */
- public DrillScanRel(RelOptCluster cluster, RelTraitSet traits,
- RelOptTable table, GroupScan groupScan, RelDataType rowType, List<SchemaPath> columns) {
+ public DrillScanRel(final RelOptCluster cluster, final RelTraitSet traits,
+ final RelOptTable table, final GroupScan groupScan, final RelDataType rowType, final List<SchemaPath> columns) {
super(DRILL_LOGICAL, cluster, traits, table);
this.rowType = rowType;
this.columns = columns;
this.groupScan = groupScan;
+ this.settings = PrelUtil.getPlannerSettings(cluster.getPlanner());
}
//
@@ -128,15 +133,15 @@ public class DrillScanRel extends DrillScanRelBase implements DrillRel {
@Override
public double getRows() {
- return this.groupScan.getScanStats().getRecordCount();
+ return this.groupScan.getScanStats(settings).getRecordCount();
}
/// 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 = groupScan.getScanStats();
+ public RelOptCost computeSelfCost(final RelOptPlanner planner) {
+ final ScanStats stats = groupScan.getScanStats(settings);
int columnCount = getRowType().getFieldCount();
double ioCost = 0;
boolean isStarQuery = Iterables.tryFind(getRowType().getFieldNames(), new Predicate<String>() {