Skip to content
Permalink
Browse files
DRILL-6463 : Fix integer overflow in MockGroupScanPOP
closes #1303
  • Loading branch information
Gautam Parai authored and sohami committed Jun 7, 2018
1 parent a27a104 commit 2902ca9a5a780b3ee8b6ec56f01e3b3df4e2f37a
Showing 3 changed files with 10 additions and 10 deletions.
@@ -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;
}

@@ -154,7 +154,7 @@ public void onMatch(RelOptRuleCall call) {
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++) {
@@ -89,7 +89,7 @@ public MockGroupScanPOP(@JsonProperty("url") String url,
// 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 MockGroupScanPOP(@JsonProperty("url") String url,

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,

0 comments on commit 2902ca9

Please sign in to comment.