Search in sources :

Example 6 with HBaseScanSpec

use of org.apache.drill.exec.store.hbase.HBaseScanSpec in project drill by apache.

the class MapRDBFilterBuilder method mergeScanSpecs.

private HBaseScanSpec mergeScanSpecs(String functionName, HBaseScanSpec leftScanSpec, HBaseScanSpec rightScanSpec) {
    Filter newFilter = null;
    byte[] startRow = HConstants.EMPTY_START_ROW;
    byte[] stopRow = HConstants.EMPTY_END_ROW;
    switch(functionName) {
        case "booleanAnd":
            //HBaseUtils.LAST_FILTER
            newFilter = HBaseUtils.andFilterAtIndex(leftScanSpec.getFilter(), -1, rightScanSpec.getFilter());
            startRow = HBaseUtils.maxOfStartRows(leftScanSpec.getStartRow(), rightScanSpec.getStartRow());
            stopRow = HBaseUtils.minOfStopRows(leftScanSpec.getStopRow(), rightScanSpec.getStopRow());
            break;
        case "booleanOr":
            //HBaseUtils.LAST_FILTER
            newFilter = HBaseUtils.orFilterAtIndex(leftScanSpec.getFilter(), -1, rightScanSpec.getFilter());
            startRow = HBaseUtils.minOfStartRows(leftScanSpec.getStartRow(), rightScanSpec.getStartRow());
            stopRow = HBaseUtils.maxOfStopRows(leftScanSpec.getStopRow(), rightScanSpec.getStopRow());
    }
    return new HBaseScanSpec(groupScan.getTableName(), startRow, stopRow, newFilter);
}
Also used : HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) RowFilter(org.apache.hadoop.hbase.filter.RowFilter) Filter(org.apache.hadoop.hbase.filter.Filter) SingleColumnValueFilter(org.apache.hadoop.hbase.filter.SingleColumnValueFilter)

Example 7 with HBaseScanSpec

use of org.apache.drill.exec.store.hbase.HBaseScanSpec in project drill by apache.

the class TestHBaseRegionScanAssignments method testHBaseGroupScanAssignmentNoAfinity.

@Test
public void testHBaseGroupScanAssignmentNoAfinity() throws Exception {
    NavigableMap<HRegionInfo, ServerName> regionsToScan = Maps.newTreeMap();
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[0], splits[1]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[1], splits[2]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[2], splits[3]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[3], splits[4]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[4], splits[5]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[5], splits[6]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[6], splits[7]), SERVER_X);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[7], splits[0]), SERVER_X);
    final List<DrillbitEndpoint> endpoints = Lists.newArrayList();
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_A).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_B).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_C).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_D).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_E).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_F).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_G).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_H).setControlPort(1234).build());
    HBaseGroupScan scan = new HBaseGroupScan();
    scan.setRegionsToScan(regionsToScan);
    scan.setHBaseScanSpec(new HBaseScanSpec(TABLE_NAME_STR, splits[0], splits[0], null));
    scan.applyAssignments(endpoints);
    int i = 0;
    // 'A'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'B'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'C'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'D'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'E'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'F'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'G'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'H'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    testParallelizationWidth(scan, i);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) ServerName(org.apache.hadoop.hbase.ServerName) HBaseGroupScan(org.apache.drill.exec.store.hbase.HBaseGroupScan) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) Test(org.junit.Test)

Example 8 with HBaseScanSpec

use of org.apache.drill.exec.store.hbase.HBaseScanSpec in project drill by apache.

the class TestHBaseRegionScanAssignments method testHBaseGroupScanAssignmentOneEach.

@Test
public void testHBaseGroupScanAssignmentOneEach() throws Exception {
    NavigableMap<HRegionInfo, ServerName> regionsToScan = Maps.newTreeMap();
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[0], splits[1]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[1], splits[2]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[2], splits[3]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[3], splits[4]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[4], splits[5]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[5], splits[6]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[6], splits[7]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[7], splits[8]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[8], splits[0]), SERVER_A);
    final List<DrillbitEndpoint> endpoints = Lists.newArrayList();
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_A).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_A).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_B).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_C).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_D).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_E).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_F).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_G).setControlPort(1234).build());
    endpoints.add(DrillbitEndpoint.newBuilder().setAddress(HOST_H).setControlPort(1234).build());
    HBaseGroupScan scan = new HBaseGroupScan();
    scan.setRegionsToScan(regionsToScan);
    scan.setHBaseScanSpec(new HBaseScanSpec(TABLE_NAME_STR, splits[0], splits[0], null));
    scan.applyAssignments(endpoints);
    int i = 0;
    // 'A'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'A'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'B'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'C'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'D'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'E'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'F'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'G'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'H'
    assertEquals(1, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    testParallelizationWidth(scan, i);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) ServerName(org.apache.hadoop.hbase.ServerName) HBaseGroupScan(org.apache.drill.exec.store.hbase.HBaseGroupScan) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) Test(org.junit.Test)

Example 9 with HBaseScanSpec

use of org.apache.drill.exec.store.hbase.HBaseScanSpec in project drill by apache.

the class TestHBaseRegionScanAssignments method testHBaseGroupScanAssignmentAllPreferred.

@Test
public void testHBaseGroupScanAssignmentAllPreferred() throws Exception {
    NavigableMap<HRegionInfo, ServerName> regionsToScan = Maps.newTreeMap();
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[0], splits[1]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[1], splits[2]), SERVER_A);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[2], splits[3]), SERVER_B);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[3], splits[4]), SERVER_B);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[4], splits[5]), SERVER_C);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[5], splits[6]), SERVER_C);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[6], splits[7]), SERVER_D);
    regionsToScan.put(new HRegionInfo(TABLE_NAME, splits[7], splits[0]), SERVER_D);
    final List<DrillbitEndpoint> endpoints = Lists.newArrayList();
    final DrillbitEndpoint DB_A = DrillbitEndpoint.newBuilder().setAddress(HOST_A).setControlPort(1234).build();
    endpoints.add(DB_A);
    final DrillbitEndpoint DB_B = DrillbitEndpoint.newBuilder().setAddress(HOST_B).setControlPort(1234).build();
    endpoints.add(DB_B);
    final DrillbitEndpoint DB_D = DrillbitEndpoint.newBuilder().setAddress(HOST_C).setControlPort(1234).build();
    endpoints.add(DB_D);
    final DrillbitEndpoint DB_X = DrillbitEndpoint.newBuilder().setAddress(HOST_D).setControlPort(1234).build();
    endpoints.add(DB_X);
    HBaseGroupScan scan = new HBaseGroupScan();
    scan.setRegionsToScan(regionsToScan);
    scan.setHBaseScanSpec(new HBaseScanSpec(TABLE_NAME_STR, splits[0], splits[0], null));
    scan.applyAssignments(endpoints);
    int i = 0;
    // 'A'
    assertEquals(2, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'B'
    assertEquals(2, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'C'
    assertEquals(2, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    // 'D'
    assertEquals(2, scan.getSpecificScan(i++).getRegionScanSpecList().size());
    testParallelizationWidth(scan, i);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) ServerName(org.apache.hadoop.hbase.ServerName) HBaseGroupScan(org.apache.drill.exec.store.hbase.HBaseGroupScan) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) Test(org.junit.Test)

Example 10 with HBaseScanSpec

use of org.apache.drill.exec.store.hbase.HBaseScanSpec in project drill by apache.

the class MapRDBFilterBuilder method createRowKeyPrefixScanSpec.

private HBaseScanSpec createRowKeyPrefixScanSpec(FunctionCall call, CompareFunctionsProcessor processor) {
    byte[] startRow = processor.getRowKeyPrefixStartRow();
    byte[] stopRow = processor.getRowKeyPrefixStopRow();
    Filter filter = processor.getRowKeyPrefixFilter();
    if (startRow != HConstants.EMPTY_START_ROW || stopRow != HConstants.EMPTY_END_ROW || filter != null) {
        return new HBaseScanSpec(groupScan.getTableName(), startRow, stopRow, filter);
    }
    // else
    return null;
}
Also used : HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) RowFilter(org.apache.hadoop.hbase.filter.RowFilter) Filter(org.apache.hadoop.hbase.filter.Filter) SingleColumnValueFilter(org.apache.hadoop.hbase.filter.SingleColumnValueFilter)

Aggregations

HBaseScanSpec (org.apache.drill.exec.store.hbase.HBaseScanSpec)13 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)5 HBaseGroupScan (org.apache.drill.exec.store.hbase.HBaseGroupScan)5 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)5 ServerName (org.apache.hadoop.hbase.ServerName)5 Test (org.junit.Test)5 Filter (org.apache.hadoop.hbase.filter.Filter)4 RowFilter (org.apache.hadoop.hbase.filter.RowFilter)4 SingleColumnValueFilter (org.apache.hadoop.hbase.filter.SingleColumnValueFilter)4 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)2 SchemaPath (org.apache.drill.common.expression.SchemaPath)2 BinaryTableGroupScan (org.apache.drill.exec.store.mapr.db.binary.BinaryTableGroupScan)2 BinaryComparator (org.apache.hadoop.hbase.filter.BinaryComparator)2 TableProperties (com.mapr.fs.tables.TableProperties)1 RelNode (org.apache.calcite.rel.RelNode)1 DrillParseContext (org.apache.drill.exec.planner.logical.DrillParseContext)1 ScanPrel (org.apache.drill.exec.planner.physical.ScanPrel)1 HBaseRegexParser (org.apache.drill.exec.store.hbase.HBaseRegexParser)1 MapRDBSubScanSpec (org.apache.drill.exec.store.mapr.db.MapRDBSubScanSpec)1 MapRDBFilterBuilder (org.apache.drill.exec.store.mapr.db.binary.MapRDBFilterBuilder)1