LadyForest commented on code in PR #21582:
URL: https://github.com/apache/flink/pull/21582#discussion_r1064283184
##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/utils/Constants.java:
##########
@@ -22,6 +22,9 @@
public class Constants {
public static final String JOB_ID = "job id";
+ public static final String JOB_NAME = "job name";
Review Comment:
Nit: I'm just wondering if we can align the literal format.
Either be `job id`, `job name`, `start time` or `job_id`, `job_name`,
`start_time`
##########
flink-table/flink-sql-parser/src/main/codegen/data/Parser.tdd:
##########
@@ -144,6 +145,7 @@
"JAR"
"JARS"
"JOB"
+ "JOBS"
Review Comment:
I thinks "JOBS" should also be added to the `nonReservedKeywords`
##########
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:
I took a cursory look at
[FLIP-222](https://cwiki.apache.org/confluence/display/FLINK/FLIP-222%3A+Support+full+job+lifecycle+statements+in+SQL+client),
the use case of `SHOW JOBS` should be like
```sql
Flink SQL> SHOW JOBS;
+----------------------------------+--------------------+---------+---------------------+---------------------+-------------+----------------------+
| job_id | job_name | status |
start_time | end_time | duration | web_url |
+----------------------------------+--------------------+---------|---------------------|---------------------|-------------|----------------------|
| 6b1af540c0c0bb3fcfcad50ac037c862 | INSERT INTO tbl_a..| RUNNING |
2022-05-01 10:20:33 | 2022-05-01 10:20:53 | 0h 0m 20s |
http://127.0.0.1:8081/|
+----------------------------------+--------------------+---------+---------------------+---------------------+-------------+----------------------+
```
Is there any reason that `end_time`, `duration` and `web_url` are omitted?
--
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]