diff options
author | Gautam Parai <gparai@maprtech.com> | 2018-06-02 12:06:21 -0700 |
---|---|---|
committer | Sorabh Hamirwasia <sorabh@apache.org> | 2018-06-07 08:52:40 -0700 |
commit | 2902ca9a5a780b3ee8b6ec56f01e3b3df4e2f37a (patch) | |
tree | 7389d25ed900b8c8c9d0b5e14abbe52b3f6b3361 /exec/java-exec | |
parent | a27a1047b16621f6c3c6c181c97f8713231f6c6c (diff) |
DRILL-6463 : Fix integer overflow in MockGroupScanPOP
closes #1303
Diffstat (limited to 'exec/java-exec')
3 files changed, 10 insertions, 10 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/ScanStats.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/ScanStats.java index f2974e16c..721f723ec 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/ScanStats.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/ScanStats.java @@ -23,27 +23,27 @@ public class ScanStats { public static final ScanStats ZERO_RECORD_TABLE = new ScanStats(GroupScanProperty.EXACT_ROW_COUNT, 0, 1, 1); - private final long recordCount; - private final float cpuCost; - private final float diskCost; + private final double recordCount; + private final double cpuCost; + private final double diskCost; private final GroupScanProperty property; - public ScanStats(GroupScanProperty property, long recordCount, float cpuCost, float diskCost) { + public ScanStats(GroupScanProperty property, double recordCount, double cpuCost, double diskCost) { this.recordCount = recordCount; this.cpuCost = cpuCost; this.diskCost = diskCost; this.property = property; } - public long getRecordCount() { + public double getRecordCount() { return recordCount; } - public float getCpuCost() { + public double getCpuCost() { return cpuCost; } - public float getDiskCost() { + public double getDiskCost() { return diskCost; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java index 62e40a540..1049b2c67 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java @@ -154,7 +154,7 @@ public class ConvertCountToDirectScan extends Prule { private Map<String, Long> collectCounts(PlannerSettings settings, DrillAggregateRel agg, DrillScanRel scan, DrillProjectRel project) { final Set<String> implicitColumnsNames = ColumnExplorer.initImplicitFileColumns(settings.getOptions()).keySet(); final GroupScan oldGrpScan = scan.getGroupScan(); - final long totalRecordCount = oldGrpScan.getScanStats(settings).getRecordCount(); + final long totalRecordCount = (long)oldGrpScan.getScanStats(settings).getRecordCount(); final LinkedHashMap<String, Long> result = new LinkedHashMap<>(); for (int i = 0; i < agg.getAggCallList().size(); i++) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java index 88c0be97b..29ce72462 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java @@ -89,7 +89,7 @@ public class MockGroupScanPOP extends AbstractGroupScan { // the planner is "fooled" into thinking that this operator will do // disk I/O. - int rowCount = 0; + double rowCount = 0; int rowWidth = 0; // Can have multiple "read entries" which simulate blocks or @@ -126,7 +126,7 @@ public class MockGroupScanPOP extends AbstractGroupScan { rowWidth = Math.max(rowWidth, groupRowWidth); } - int dataSize = rowCount * rowWidth; + double dataSize = rowCount * rowWidth; scanStats = new ScanStats(GroupScanProperty.EXACT_ROW_COUNT, rowCount, DrillCostBase.BASE_CPU_COST * dataSize, |