[ 
https://issues.apache.org/jira/browse/DRILL-6463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16505455#comment-16505455
 ] 

ASF GitHub Bot commented on DRILL-6463:
---------------------------------------

sohami closed pull request #1303: DRILL-6463 : Fix integer overflow in 
MockGroupScanPOP
URL: https://github.com/apache/drill/pull/1303
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 f2974e16c5..721f723ecb 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 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 62e40a5408..1049b2c676 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 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++) {
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 88c0be97bb..29ce724629 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 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,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> ProfileParser cannot parse costs when using MockScanBatch
> ---------------------------------------------------------
>
>                 Key: DRILL-6463
>                 URL: https://issues.apache.org/jira/browse/DRILL-6463
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.13.0
>            Reporter: Gautam Kumar Parai
>            Assignee: Gautam Kumar Parai
>            Priority: Major
>              Labels: ready-to-commit
>             Fix For: 1.14.0
>
>
> One of the unit testHashAggrSecondaryTertiarySpill() runs into this issue 
> although the issue is generic. It happens due to cost being stored in an int 
> which overflows with big enough rows/data size and becomes negative. This 
> causes the Profile parser to error out on seeing negative costs.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to