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;
}
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;
}
Aggregations