Search in sources :

Example 1 with RowKeyJoin

use of org.apache.drill.exec.physical.impl.join.RowKeyJoin in project drill by apache.

the class RestrictedJsonRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    RestrictedMapRDBSubScanSpec rss = ((RestrictedMapRDBSubScanSpec) this.subScanSpec);
    RowKeyJoin rjBatch = rss.getJoinForSubScan();
    if (rjBatch == null) {
        throw new ExecutionSetupException("RowKeyJoin Batch is not setup for Restricted MapRDB Subscan");
    }
    AbstractRecordBatch.BatchState state = rjBatch.getBatchState();
    if (state == AbstractRecordBatch.BatchState.BUILD_SCHEMA || state == AbstractRecordBatch.BatchState.FIRST) {
        super.setup(context, output);
    }
    return;
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) RestrictedMapRDBSubScanSpec(org.apache.drill.exec.store.mapr.db.RestrictedMapRDBSubScanSpec) RowKeyJoin(org.apache.drill.exec.physical.impl.join.RowKeyJoin) AbstractRecordBatch(org.apache.drill.exec.record.AbstractRecordBatch)

Example 2 with RowKeyJoin

use of org.apache.drill.exec.physical.impl.join.RowKeyJoin in project drill by apache.

the class RestrictedJsonRecordReader method hasNext.

@Override
public boolean hasNext() {
    RestrictedMapRDBSubScanSpec rss = ((RestrictedMapRDBSubScanSpec) this.subScanSpec);
    RowKeyJoin rjBatch = rss.getJoinForSubScan();
    if (rjBatch == null) {
        return false;
    }
    boolean hasMore = false;
    AbstractRecordBatch.BatchState state = rss.getJoinForSubScan().getBatchState();
    RowKeyJoin.RowKeyJoinState rkState = rss.getJoinForSubScan().getRowKeyJoinState();
    if (state == AbstractRecordBatch.BatchState.BUILD_SCHEMA) {
        hasMore = true;
    } else if (state == AbstractRecordBatch.BatchState.FIRST) {
        if (this.maxRecordsToRead > 0) {
            rss.getJoinForSubScan().setBatchState(AbstractRecordBatch.BatchState.NOT_FIRST);
            rss.getJoinForSubScan().setRowKeyJoinState(RowKeyJoin.RowKeyJoinState.PROCESSING);
            hasMore = true;
        }
    } else if (rkState == RowKeyJoin.RowKeyJoinState.INITIAL) {
        if (this.maxRecordsToRead > 0) {
            rss.getJoinForSubScan().setRowKeyJoinState(RowKeyJoin.RowKeyJoinState.PROCESSING);
            hasMore = true;
        }
    }
    logger.debug("restricted reader hasMore = {}", hasMore);
    return hasMore;
}
Also used : RestrictedMapRDBSubScanSpec(org.apache.drill.exec.store.mapr.db.RestrictedMapRDBSubScanSpec) RowKeyJoin(org.apache.drill.exec.physical.impl.join.RowKeyJoin) AbstractRecordBatch(org.apache.drill.exec.record.AbstractRecordBatch)

Aggregations

RowKeyJoin (org.apache.drill.exec.physical.impl.join.RowKeyJoin)2 AbstractRecordBatch (org.apache.drill.exec.record.AbstractRecordBatch)2 RestrictedMapRDBSubScanSpec (org.apache.drill.exec.store.mapr.db.RestrictedMapRDBSubScanSpec)2 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)1