link3280 commented on code in PR #21582:
URL: https://github.com/apache/flink/pull/21582#discussion_r1064434734
##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationExecutor.java:
##########
@@ -524,6 +533,47 @@ private ResultFetcher buildOkResultFetcher(OperationHandle
handle) {
TableResultInternal.TABLE_RESULT_OK.collectInternal()));
}
+ public ResultFetcher callShowJobsOperation(
+ OperationHandle operationHandle, ShowJobsOperation
showJobsOperation)
+ throws SqlExecutionException {
+ try {
+ Collection<JobStatusMessage> jobs =
+ runClusterAction(
+ operationHandle,
+ clusterClient -> {
+ try {
+ return clusterClient.listJobs().get();
+ } catch (Exception e) {
+ throw new FlinkException(e);
+ }
+ });
+ List<RowData> resultRows =
+ jobs.stream()
+ .map(
+ job ->
+ GenericRowData.of(
Review Comment:
It requires changes to `JobStatusMessage` and `RestClient` of `flink-client`
module, so I thought it'd be clear to leave the rest columns to another PR. But
I'm OK to add them in one PR if you think that's better.
##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationExecutor.java:
##########
@@ -524,6 +533,47 @@ private ResultFetcher buildOkResultFetcher(OperationHandle
handle) {
TableResultInternal.TABLE_RESULT_OK.collectInternal()));
}
+ public ResultFetcher callShowJobsOperation(
+ OperationHandle operationHandle, ShowJobsOperation
showJobsOperation)
+ throws SqlExecutionException {
+ try {
+ Collection<JobStatusMessage> jobs =
+ runClusterAction(
+ operationHandle,
+ clusterClient -> {
+ try {
+ return clusterClient.listJobs().get();
+ } catch (Exception e) {
+ throw new FlinkException(e);
+ }
+ });
+ List<RowData> resultRows =
+ jobs.stream()
+ .map(
+ job ->
+ GenericRowData.of(
Review Comment:
It requires changes to `JobStatusMessage` and `RestClient` in `flink-client`
module, so I thought it'd be clear to leave the rest columns to another PR. But
I'm OK to add them in one PR if you think that's better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]