use of herddb.model.ScanResult in project herddb by diennea.
the class ProjectOp method execute.
@Override
public StatementExecutionResult execute(TableSpaceManager tableSpaceManager, TransactionContext transactionContext, StatementEvaluationContext context, boolean lockRequired, boolean forWrite) throws StatementExecutionException {
// TODO merge projection + scan + sort + limit
StatementExecutionResult input = this.input.execute(tableSpaceManager, transactionContext, context, lockRequired, forWrite);
ScanResult downstream = (ScanResult) input;
DataScanner dataScanner = downstream.dataScanner;
DataScanner projected = new ProjectedDataScanner(dataScanner, projection.getFieldNames(), projection.getColumns(), context);
return new ScanResult(downstream.transactionId, projected);
}
use of herddb.model.ScanResult in project herddb by diennea.
the class SortOp method execute.
@Override
public StatementExecutionResult execute(TableSpaceManager tableSpaceManager, TransactionContext transactionContext, StatementEvaluationContext context, boolean lockRequired, boolean forWrite) throws StatementExecutionException {
// TODO merge projection + scan + sort + limit
StatementExecutionResult input = this.input.execute(tableSpaceManager, transactionContext, context, lockRequired, forWrite);
ScanResult downstreamScanResult = (ScanResult) input;
final DataScanner inputScanner = downstreamScanResult.dataScanner;
try (DataScanner dataScanner = inputScanner) {
MaterializedRecordSet recordSet = tableSpaceManager.getDbmanager().getRecordSetFactory().createRecordSet(inputScanner.getFieldNames(), inputScanner.getSchema());
while (dataScanner.hasNext()) {
DataAccessor row = dataScanner.next();
recordSet.add(row);
}
recordSet.writeFinished();
recordSet.sort(this);
SimpleDataScanner result = new SimpleDataScanner(downstreamScanResult.transactionId, recordSet);
return new ScanResult(downstreamScanResult.transactionId, result);
} catch (DataScannerException ex) {
throw new StatementExecutionException(ex);
}
}
use of herddb.model.ScanResult in project herddb by diennea.
the class AggregateOp method execute.
@Override
public StatementExecutionResult execute(TableSpaceManager tableSpaceManager, TransactionContext transactionContext, StatementEvaluationContext context, boolean lockRequired, boolean forWrite) throws StatementExecutionException {
StatementExecutionResult input = this.input.execute(tableSpaceManager, transactionContext, context, lockRequired, forWrite);
ScanResult downstreamScanResult = (ScanResult) input;
final DataScanner inputScanner = downstreamScanResult.dataScanner;
AggregatedDataScanner filtered = new AggregatedDataScanner(inputScanner, context, tableSpaceManager.getDbmanager().getRecordSetFactory());
return new ScanResult(downstreamScanResult.transactionId, filtered);
}
Aggregations