use of com.scalar.db.api.Selection in project scalardb by scalar-labs.
the class SelectStatementHandler method execute.
@Override
@Nonnull
protected List<Record> execute(Operation operation) throws CosmosException, ExecutionException {
assert operation instanceof Selection;
Selection selection = (Selection) operation;
TableMetadata tableMetadata = metadataManager.getTableMetadata(operation);
try {
if (selection instanceof Get) {
return executeRead((Get) selection, tableMetadata);
} else {
return executeQuery((Scan) selection, tableMetadata);
}
} catch (CosmosException e) {
if (e.getStatusCode() == CosmosErrorCode.NOT_FOUND.get()) {
return Collections.emptyList();
}
throw e;
}
}
Aggregations