drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sohami <...@git.apache.org>
Subject [GitHub] drill pull request #752: DRILL-5258: Access mock data definition from SQL
Date Wed, 22 Feb 2017 01:23:47 GMT
Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/752#discussion_r102360734
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java
---
    @@ -75,20 +76,50 @@
        */
     
       private boolean extended;
    +  private ScanStats scanStats = ScanStats.TRIVIAL_TABLE;
     
       @JsonCreator
       public MockGroupScanPOP(@JsonProperty("url") String url,
    -      @JsonProperty("extended") Boolean extended,
           @JsonProperty("entries") List<MockScanEntry> readEntries) {
         super((String) null);
         this.readEntries = readEntries;
         this.url = url;
    -    this.extended = extended == null ? false : extended;
    +
    +    // Compute decent row-count stats for this mock data source so that
    +    // the planner is "fooled" into thinking that this operator wil do
    +    // disk I/O.
    +
    +    int rowCount = 0;
    +    int rowWidth = 0;
    +    for (MockScanEntry entry : readEntries) {
    +      rowCount += entry.getRecords();
    +      int width = 0;
    +      if (entry.getTypes() == null) {
    +        width = 50;
    +      } else {
    +        for (MockColumn col : entry.getTypes()) {
    +          int colWidth = 0;
    +          if (col.getWidthValue() == 0) {
    +            colWidth = TypeHelper.getSize(col.getMajorType());
    +          } else {
    +            colWidth = col.getWidthValue();
    +          }
    +          colWidth *= col.getRepeatCount();
    +          width += colWidth;
    +        }
    +      }
    +      rowWidth = Math.max(rowWidth, width);
    --- End diff --
    
    `rowWidth` seems to be `maxRowWidth` and `width` is `rowWidth`. Can we please rename these
?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message