Search in sources :

Example 1 with TabletInfo

use of com.mapr.db.TabletInfo in project drill by apache.

the class JsonTableGroupScan method computeRegionsToScan.

/**
   * Compute regions to scan based on the scanSpec
   */
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;
        }
    }
}
Also used : TabletInfoImpl(com.mapr.db.impl.TabletInfoImpl) TabletFragmentInfo(org.apache.drill.exec.store.mapr.db.TabletFragmentInfo) TabletInfo(com.mapr.db.TabletInfo)

Example 2 with TabletInfo

use of com.mapr.db.TabletInfo in project drill by apache.

the class JsonTableGroupScan method init.

private void init() {
    logger.debug("Getting tablet locations");
    try {
        Configuration conf = new Configuration();
        // Fetch table and tabletInfo only once and cache.
        table = MapRDB.getTable(scanSpec.getTableName());
        tabletInfos = table.getTabletInfos(scanSpec.getCondition());
        // duplicate work and RPCs to MapR DB server.
        for (TabletInfo tabletInfo : tabletInfos) {
            totalRowCount += tabletInfo.getEstimatedNumRows();
        }
        computeRegionsToScan();
    } catch (Exception e) {
        throw new DrillRuntimeException("Error getting region info for table: " + scanSpec.getTableName(), e);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) TabletInfo(com.mapr.db.TabletInfo) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) IOException(java.io.IOException)

Aggregations

TabletInfo (com.mapr.db.TabletInfo)2 TabletInfoImpl (com.mapr.db.impl.TabletInfoImpl)1 IOException (java.io.IOException)1 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)1 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)1 TabletFragmentInfo (org.apache.drill.exec.store.mapr.db.TabletFragmentInfo)1 Configuration (org.apache.hadoop.conf.Configuration)1