use of org.apache.flink.table.client.gateway.local.result.DynamicResult in project flink by apache.
the class LocalExecutor method executeQuery.
@Override
public ResultDescriptor executeQuery(String sessionId, QueryOperation query) throws SqlExecutionException {
final TableResultInternal tableResult = executeOperation(sessionId, query);
final SessionContext context = getSessionContext(sessionId);
final ReadableConfig config = context.getReadableConfig();
final DynamicResult result = resultStore.createResult(config, tableResult);
checkArgument(tableResult.getJobClient().isPresent());
String jobId = tableResult.getJobClient().get().getJobID().toString();
// store the result under the JobID
resultStore.storeResult(jobId, result);
return new ResultDescriptor(jobId, tableResult.getResolvedSchema(), result.isMaterialized(), config, tableResult.getRowDataToStringConverter());
}
use of org.apache.flink.table.client.gateway.local.result.DynamicResult in project flink by apache.
the class LocalExecutor method cancelQuery.
@Override
public void cancelQuery(String sessionId, String resultId) throws SqlExecutionException {
final DynamicResult result = resultStore.getResult(resultId);
if (result == null) {
throw new SqlExecutionException("Could not find a result with result identifier '" + resultId + "'.");
}
// stop retrieval and remove the result
LOG.info("Cancelling job {} and result retrieval.", resultId);
try {
// this operator will also stop flink job
result.close();
} catch (Exception e) {
throw new SqlExecutionException("Could not cancel the query execution", e);
}
resultStore.removeResult(resultId);
}
Aggregations