use of org.apache.calcite.avatica.NoSuchStatementException in project calcite-avatica by apache.
the class LocalService method apply.
public ExecuteResponse apply(PrepareAndExecuteRequest request) {
try (final Context ignore = prepareAndExecuteTimer.start()) {
final Meta.StatementHandle sh = new Meta.StatementHandle(request.connectionId, request.statementId, null);
try {
final Meta.ExecuteResult executeResult = meta.prepareAndExecute(sh, request.sql, request.maxRowCount, request.maxRowsInFirstFrame, new Meta.PrepareCallback() {
@Override
public Object getMonitor() {
return LocalService.class;
}
@Override
public void clear() {
}
@Override
public void assign(Meta.Signature signature, Meta.Frame firstFrame, long updateCount) {
}
@Override
public void execute() {
}
});
final List<ResultSetResponse> results = new ArrayList<>();
for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) {
results.add(toResponse(metaResultSet));
}
return new ExecuteResponse(results, false, serverLevelRpcMetadata);
} catch (NoSuchStatementException e) {
// The Statement doesn't exist anymore, bubble up this information
return new ExecuteResponse(null, true, serverLevelRpcMetadata);
}
}
}
Aggregations