You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by so...@apache.org on 2018/06/07 23:14:09 UTC

[drill] 02/03: DRILL-6463 : Fix integer overflow in MockGroupScanPOP

This is an automated email from the ASF dual-hosted git repository.

sorabh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 2902ca9a5a780b3ee8b6ec56f01e3b3df4e2f37a
Author: Gautam Parai <gp...@maprtech.com>
AuthorDate: Sat Jun 2 12:06:21 2018 -0700

    DRILL-6463 : Fix integer overflow in MockGroupScanPOP
    
    closes #1303
---
 .../org/apache/drill/exec/physical/base/ScanStats.java     | 14 +++++++-------
 .../exec/planner/physical/ConvertCountToDirectScan.java    |  2 +-
 .../org/apache/drill/exec/store/mock/MockGroupScanPOP.java |  4 ++--
 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 f2974e1..721f723 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 62e40a5..1049b2c 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 88c0be9..29ce724 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,

-- 
To stop receiving notification emails like this one, please contact
sorabh@apache.org.