drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gparai <...@git.apache.org>
Subject [GitHub] drill pull request #817: DRILL-5429: Improve query performance for MapR DB J...
Date Tue, 02 May 2017 21:34:37 GMT
Github user gparai commented on a diff in the pull request:

    https://github.com/apache/drill/pull/817#discussion_r114430230
  
    --- Diff: contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/json/JsonTableGroupScan.java
---
    @@ -100,30 +104,46 @@ public GroupScan clone(List<SchemaPath> columns) {
         return newScan;
       }
     
    +  public JsonTableGroupScan clone(JsonScanSpec scanSpec) {
    +    JsonTableGroupScan newScan = new JsonTableGroupScan(this);
    +    newScan.scanSpec = scanSpec;
    +    newScan.computeRegionsToScan();
    +    return newScan;
    +  }
    +
    +  private void computeRegionsToScan() {
    +    boolean foundStartRegion = false;
    +
    +    regionsToScan = new TreeMap<TabletFragmentInfo, String>();
    +    for (TabletInfo tabletInfo : tabletInfos) {
    +      TabletInfoImpl tabletInfoImpl = (TabletInfoImpl) tabletInfo;
    +      if (!foundStartRegion && !isNullOrEmpty(scanSpec.getStartRow()) &&
!tabletInfoImpl.containsRow(scanSpec.getStartRow())) {
    +        continue;
    +      }
    +      foundStartRegion = true;
    +      regionsToScan.put(new TabletFragmentInfo(tabletInfoImpl), tabletInfo.getLocations()[0]);
    +      if (!isNullOrEmpty(scanSpec.getStopRow()) && tabletInfoImpl.containsRow(scanSpec.getStopRow()))
{
    +        break;
    +      }
    +    }
    +  }
    +
       private void init() {
         logger.debug("Getting tablet locations");
         try {
           Configuration conf = new Configuration();
    -      Table t = MapRDB.getTable(scanSpec.getTableName());
    -      TabletInfo[] tabletInfos = t.getTabletInfos(scanSpec.getCondition());
    -      tableStats = new MapRDBTableStats(conf, scanSpec.getTableName());
     
    -      boolean foundStartRegion = false;
    -      regionsToScan = new TreeMap<TabletFragmentInfo, String>();
    +      // Fetch table and tabletInfo only once and cache.
    +      table = MapRDB.getTable(scanSpec.getTableName());
    +      tabletInfos = table.getTabletInfos(scanSpec.getCondition());
    +
    +      // Calculate totalRowCount for the table
    --- End diff --
    
    Please add a comment explaining why we compute the totalRowCount like so? 
    `totalRowCount += tabletInfo.getEstimatedNumRows();`


---
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