-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-35194][table] Support describe job with job id
- Loading branch information
1 parent
f886687
commit 83116a8
Showing
9 changed files
with
257 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/dql/SqlDescribeJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.sql.parser.dql; | ||
|
||
import org.apache.calcite.sql.SqlCall; | ||
import org.apache.calcite.sql.SqlCharStringLiteral; | ||
import org.apache.calcite.sql.SqlKind; | ||
import org.apache.calcite.sql.SqlNode; | ||
import org.apache.calcite.sql.SqlOperator; | ||
import org.apache.calcite.sql.SqlSpecialOperator; | ||
import org.apache.calcite.sql.SqlWriter; | ||
import org.apache.calcite.sql.parser.SqlParserPos; | ||
import org.apache.calcite.util.NlsString; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** DESCRIBE | DESC <JOB_ID> sql call. */ | ||
public class SqlDescribeJob extends SqlCall { | ||
|
||
public static final SqlOperator OPERATOR = | ||
new SqlSpecialOperator("DESCRIBE JOB", SqlKind.OTHER); | ||
|
||
private final SqlCharStringLiteral jobId; | ||
|
||
public SqlDescribeJob(SqlParserPos pos, SqlCharStringLiteral jobId) { | ||
super(pos); | ||
this.jobId = jobId; | ||
} | ||
|
||
public String getJobId() { | ||
return jobId.getValueAs(NlsString.class).getValue(); | ||
} | ||
|
||
@Override | ||
public SqlOperator getOperator() { | ||
return OPERATOR; | ||
} | ||
|
||
@Override | ||
public List<SqlNode> getOperandList() { | ||
return Collections.singletonList(jobId); | ||
} | ||
|
||
@Override | ||
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { | ||
writer.keyword("DESCRIBE JOB"); | ||
jobId.unparse(writer, leftPrec, rightPrec); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...pi-java/src/main/java/org/apache/flink/table/operations/command/DescribeJobOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.table.operations.command; | ||
|
||
import org.apache.flink.annotation.Internal; | ||
import org.apache.flink.table.api.internal.TableResultInternal; | ||
import org.apache.flink.table.operations.ExecutableOperation; | ||
import org.apache.flink.table.operations.Operation; | ||
|
||
/** Operation to describe a DESCRIBE JOB statement. */ | ||
@Internal | ||
public class DescribeJobOperation implements Operation, ExecutableOperation { | ||
|
||
private final String jobId; | ||
|
||
public DescribeJobOperation(String jobId) { | ||
this.jobId = jobId; | ||
} | ||
|
||
public String getJobId() { | ||
return jobId; | ||
} | ||
|
||
@Override | ||
public String asSummaryString() { | ||
return String.format("DESCRIBE JOB '%s'", jobId); | ||
} | ||
|
||
@Override | ||
public TableResultInternal execute(Context ctx) { | ||
// TODO: We may need to migrate the execution for ShowJobsOperation from SQL Gateway | ||
// OperationExecutor to here. | ||
throw new UnsupportedOperationException( | ||
"DescribeJobOperation does not support ExecutableOperation yet."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters