diff --git a/docs/content.zh/docs/dev/table/sql-gateway/overview.md b/docs/content.zh/docs/dev/table/sql-gateway/overview.md index 7848ed64a2d0c..1a6118e0021ce 100644 --- a/docs/content.zh/docs/dev/table/sql-gateway/overview.md +++ b/docs/content.zh/docs/dev/table/sql-gateway/overview.md @@ -116,6 +116,34 @@ $ curl --request GET http://localhost:8083/v1/sessions/${sessionHandle}/operatio 结果中的 `nextResultUri` 不是null时,用于获取下一批结果。 +### Deploy Script + +SQL Gateway supports to deploy a script in [Application Mode]({{< ref "docs/deployment/overview" >}}). In application mode, Job Master is responsible for the script compiling. +If you want to use custom resources in the script, e.g. Kafka Source, please use [ADD JAR]({{< ref "docs/dev/table/sql/jar">}}) command to download the required sources. + +Here is an example to deploy script to Flink native K8S Cluster with cluster id `CLUSTER_ID`. + +```bash +$ curl --request POST http://localhost:8083/sessions/${SESSION_HANDLE}/scripts \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "script": "CREATE TEMPORARY TABLE sink(a INT) WITH ( '\''connector'\'' = '\''blackhole'\''); INSERT INTO sink VALUES (1), (2), (3);", + "executionConfig": { + "execution.target": "kubernetes-application", + "kubernetes.cluster-id": "'${CLUSTER_ID}'", + "kubernetes.container.image.ref": "'${FLINK_IMAGE_NAME}'", + "jobmanager.memory.process.size": "1000m", + "taskmanager.memory.process.size": "1000m", + "kubernetes.jobmanager.cpu": 0.5, + "kubernetes.taskmanager.cpu": 0.5, + "kubernetes.rest-service.exposed.type": "NodePort" + } +}' +``` + +Note If you want to run script with PyFlink, please use an image with PyFlink installed. You can refer to +[Enabling PyFlink in docker]({{< ref "docs/deployment/resource-providers/standalone/docker" >}}#enabling-python) for more details. + ```bash $ curl --request GET ${nextResultUri} ``` diff --git a/docs/content.zh/docs/dev/table/sql-gateway/rest.md b/docs/content.zh/docs/dev/table/sql-gateway/rest.md index 6f0cc482021fb..4888df77b961a 100644 --- a/docs/content.zh/docs/dev/table/sql-gateway/rest.md +++ b/docs/content.zh/docs/dev/table/sql-gateway/rest.md @@ -93,11 +93,13 @@ REST API OpenAPI 规范如下,默认版本是 v3。 -| Version | Description | -| ----------- |--------------------------------| -| [Open API v1 specification]({{< ref_static "generated/rest_v1_sql_gateway.yml" >}}) | 允许用户提交 SQL 语句到 Gateway 并执行。 | -| [Open API v2 specification]({{< ref_static "generated/rest_v2_sql_gateway.yml" >}}) | 支持 SQL 客户端连接到 Gateway。 | -| [Open API v3 specification]({{< ref_static "generated/rest_v3_sql_gateway.yml" >}}) | 支持 Materialized Table 刷新操作。 | +| Version | Description | +| ----------- |-------------------------------| +| [Open API v1 specification]({{< ref_static "generated/rest_v1_sql_gateway.yml" >}}) | 允许用户提交 SQL 语句到 Gateway 并执行。 | +| [Open API v2 specification]({{< ref_static "generated/rest_v2_sql_gateway.yml" >}}) | 支持 SQL 客户端连接到 Gateway。 | +| [Open API v3 specification]({{< ref_static "generated/rest_v3_sql_gateway.yml" >}}) | 支持 Materialized Table 刷新操作。 | +| [Open API v4 specification]({{< ref_static "generated/rest_v4_sql_gateway.yml" >}}) | 支持使用 Application 模式部署 SQL 脚本。 | + {{< hint warning >}} OpenAPI 规范目前仍处于实验阶段。 @@ -106,6 +108,11 @@ OpenAPI 规范目前仍处于实验阶段。 #### API reference {{< tabs "f00ed142-b05f-44f0-bafc-799080c1d40d" >}} +{{< tab "v4" >}} + +{{< generated/rest_v4_sql_gateway >}} + +{{< /tab >}} {{< tab "v3" >}} {{< generated/rest_v3_sql_gateway >}} diff --git a/docs/content.zh/docs/dev/table/sqlClient.md b/docs/content.zh/docs/dev/table/sqlClient.md index 9fc664fbc34ef..273e9f5008c93 100644 --- a/docs/content.zh/docs/dev/table/sqlClient.md +++ b/docs/content.zh/docs/dev/table/sqlClient.md @@ -610,7 +610,7 @@ SQL Client will print success message if the statement is executed successfully. By default, the error message only contains the error cause. In order to print the full exception stack for debugging, please set the `sql-client.verbose` to true through command `SET 'sql-client.verbose' = 'true';`. -### Execute SQL Files +### Execute SQL Files in a Session Cluster SQL Client supports to execute a SQL script file with the `-f` option. SQL Client will execute statements one by one in the SQL script file and print execution messages for each executed statements. @@ -663,6 +663,24 @@ This configuration: Attention Compared to the interactive mode, SQL Client will stop execution and exits when there are errors. +### Deploy SQL Files in an Application Cluster + +SQL Client also supports to deploy a SQL script file to an application cluster with the `-f` option if you specify the deployment target in the config.yaml or startup options. +Here is an example to deploy script file in an application cluster. + +```bash +./bin/sql-client.sh -f oss://path/to/script.sql \ + -Dexecution.target=kubernetes-application \ + -Dkubernetes.cluster-id=${CLUSTER_ID} \ + -Dkubernetes.container.image.ref=${FLINK_IMAGE_NAME}' +``` + +After execution, SQL Client print the cluster id on the terminal. The script can contain any statement that is supported by Flink. But Application cluster only supports one job, please refer to the +[Application Mode]({{< ref "docs/deployment/overview#application-mode" >}}) for the limitations. + +Attention When deploying a script to the cluster, SQL Client only supports to run with `--jars` startup option, other options, e.g. `--init` +are not supported. + ### Execute a set of SQL statements SQL Client execute each INSERT INTO statement as a single Flink job. However, this is sometimes not diff --git a/docs/content/docs/dev/table/sql-gateway/overview.md b/docs/content/docs/dev/table/sql-gateway/overview.md index a46c2628c050f..037c456dee1a2 100644 --- a/docs/content/docs/dev/table/sql-gateway/overview.md +++ b/docs/content/docs/dev/table/sql-gateway/overview.md @@ -122,6 +122,34 @@ The `nextResultUri` in the results is used to fetch the next batch results if it $ curl --request GET ${nextResultUri} ``` +### Deploy Script + +SQL Gateway supports to deploy a script in [Application Mode]({{< ref "docs/deployment/overview" >}}). In application mode, Job Master is responsible for the script compiling. +If you want to use custom resources in the script, e.g. Kafka Source, please use [ADD JAR]({{< ref "docs/dev/table/sql/jar">}}) command to download the required sources. + +Here is an example to deploy script to Flink native K8S Cluster with cluster id `CLUSTER_ID`. + +```bash +$ curl --request POST http://localhost:8083/sessions/${SESSION_HANDLE}/scripts \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "script": "CREATE TEMPORARY TABLE sink(a INT) WITH ( '\''connector'\'' = '\''blackhole'\''); INSERT INTO sink VALUES (1), (2), (3);", + "executionConfig": { + "execution.target": "kubernetes-application", + "kubernetes.cluster-id": "'${CLUSTER_ID}'", + "kubernetes.container.image.ref": "'${FLINK_IMAGE_NAME}'", + "jobmanager.memory.process.size": "1000m", + "taskmanager.memory.process.size": "1000m", + "kubernetes.jobmanager.cpu": 0.5, + "kubernetes.taskmanager.cpu": 0.5, + "kubernetes.rest-service.exposed.type": "NodePort" + } +}' +``` + +Note If you want to run script with PyFlink, please use an image with PyFlink installed. You can refer to +[Enabling PyFlink in docker]({{< ref "docs/deployment/resource-providers/standalone/docker" >}}#enabling-python) for more details. + Configuration ---------------- diff --git a/docs/content/docs/dev/table/sql-gateway/rest.md b/docs/content/docs/dev/table/sql-gateway/rest.md index eafefaad72b89..40d109abbbbd1 100644 --- a/docs/content/docs/dev/table/sql-gateway/rest.md +++ b/docs/content/docs/dev/table/sql-gateway/rest.md @@ -96,11 +96,12 @@ REST API The available OpenAPI specification is as follows. The default version is v3. -| Version | Description | -| ----------- | ------- | +| Version | Description | +|-------------------------------------------------------------------------------------|--------------------------------------------------------------| | [Open API v1 specification]({{< ref_static "generated/rest_v1_sql_gateway.yml" >}}) | Allow users to submit statements to the gateway and execute. | -| [Open API v2 specification]({{< ref_static "generated/rest_v2_sql_gateway.yml" >}}) | Supports SQL Client to connect to the gateway. | -| [Open API v3 specification]({{< ref_static "generated/rest_v3_sql_gateway.yml" >}}) | Supports Materialized Table refresh operation. | +| [Open API v2 specification]({{< ref_static "generated/rest_v2_sql_gateway.yml" >}}) | Supports SQL Client to connect to the gateway. | +| [Open API v3 specification]({{< ref_static "generated/rest_v3_sql_gateway.yml" >}}) | Supports Materialized Table refresh operation. | +| [Open API v4 specification]({{< ref_static "generated/rest_v4_sql_gateway.yml" >}}) | Supports to deploy script in application mode. | {{< hint warning >}} The OpenAPI specification is still experimental. @@ -109,6 +110,11 @@ The OpenAPI specification is still experimental. #### API reference {{< tabs "f00ed142-b05f-44f0-bafc-799080c1d40d" >}} +{{< tab "v4" >}} + +{{< generated/rest_v4_sql_gateway >}} + +{{< /tab >}} {{< tab "v3" >}} {{< generated/rest_v3_sql_gateway >}} diff --git a/docs/content/docs/dev/table/sqlClient.md b/docs/content/docs/dev/table/sqlClient.md index 55405d049f057..3b30ffc7973c6 100644 --- a/docs/content/docs/dev/table/sqlClient.md +++ b/docs/content/docs/dev/table/sqlClient.md @@ -548,7 +548,7 @@ SQL Client will print success message if the statement is executed successfully. By default, the error message only contains the error cause. In order to print the full exception stack for debugging, please set the `sql-client.verbose` to true through command `SET 'sql-client.verbose' = 'true';`. -### Execute SQL Files +### Execute SQL Files in a Session Cluster SQL Client supports to execute a SQL script file with the `-f` option. SQL Client will execute statements one by one in the SQL script file and print execution messages for each executed statements. @@ -601,6 +601,24 @@ This configuration: Attention Compared to the interactive mode, SQL Client will stop execution and exits when there are errors. +### Deploy SQL Files in an Application Cluster + +SQL Client also supports to deploy a SQL script file to an application cluster with the `-f` option if you specify the deployment target in the config.yaml or startup options. +Here is an example to deploy script file in an application cluster. + +```bash +./bin/sql-client.sh -f oss://path/to/script.sql \ + -Dexecution.target=kubernetes-application \ + -Dkubernetes.cluster-id=${CLUSTER_ID} \ + -Dkubernetes.container.image.ref=${FLINK_IMAGE_NAME}' +``` + +After execution, SQL Client print the cluster id on the terminal. The script can contain any statement that is supported by Flink. But Application cluster only supports one job, please refer to the +[Application Mode]({{< ref "docs/deployment/overview#application-mode" >}}) for the limitations. + +Attention When deploying a script to the cluster, SQL Client only supports to run with `--jars` startup option, other options, e.g. `--init` +are not supported. + ### Execute a set of SQL statements SQL Client execute each INSERT INTO statement as a single Flink job. However, this is sometimes not diff --git a/docs/layouts/shortcodes/generated/rest_v4_sql_gateway.html b/docs/layouts/shortcodes/generated/rest_v4_sql_gateway.html new file mode 100644 index 0000000000000..94c47f1fc8d2a --- /dev/null +++ b/docs/layouts/shortcodes/generated/rest_v4_sql_gateway.html @@ -0,0 +1,746 @@ + + + + + + + + + + + + + + + + + + + +
/api_versions
Verb: GETResponse code: 200 OK
Get the current available versions for the Rest Endpoint. The client can choose one of the return version as the protocol for later communicate.
+
+
+ + + + + + + + + + + + + + + + + + + +
/info
Verb: GETResponse code: 200 OK
Get meta data for this cluster.
+
+
+ + + + + + + + + + + + + + + + + + + +
/sessions
Verb: POSTResponse code: 200 OK
Opens a new session with specific properties. Specific properties can be given for current session which will override the default properties of gateway.
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle
Verb: DELETEResponse code: 200 OK
Closes the specific session.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle
Verb: GETResponse code: 200 OK
Get the session configuration.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/complete-statement
Verb: GETResponse code: 200 OK
Get the completion hints for the given statement at the given position.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/configure-session
Verb: POSTResponse code: 200 OK
Configures the session with the statement which could be: +CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE DATABASE, DROP DATABASE, ALTER DATABASE, CREATE FUNCTION, DROP FUNCTION, ALTER FUNCTION, CREATE CATALOG, DROP CATALOG, USE CATALOG, USE [CATALOG.]DATABASE, CREATE VIEW, DROP VIEW, LOAD MODULE, UNLOAD MODULE, USE MODULE, ADD JAR.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/heartbeat
Verb: POSTResponse code: 200 OK
Trigger heartbeat to tell the server that the client is active, and to keep the session alive as long as configured timeout value.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/operations/:operation_handle/cancel
Verb: POSTResponse code: 200 OK
Cancel the operation.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
  • operation_handle - The OperationHandle that identifies a operation.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/operations/:operation_handle/close
Verb: DELETEResponse code: 200 OK
Close the operation.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
  • operation_handle - The OperationHandle that identifies a operation.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/operations/:operation_handle/result/:token
Verb: GETResponse code: 200 OK
Fetch results of Operation.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
  • operation_handle - The OperationHandle that identifies a operation.
  • +
  • token - The token that identifies which batch of data to fetch.
  • +
+
Query parameters
+
    +
  • rowFormat (mandatory): The row format to serialize the RowData.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/operations/:operation_handle/status
Verb: GETResponse code: 200 OK
Get the status of operation.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
  • operation_handle - The OperationHandle that identifies a operation.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/scripts
Verb: POSTResponse code: 202 Accepted
Deploy the script in application mode
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
/sessions/:session_handle/statements
Verb: POSTResponse code: 200 OK
Execute a statement.
Path parameters
+
    +
  • session_handle - The SessionHandle that identifies a session.
  • +
+
+
+
diff --git a/docs/static/generated/rest_v1_dispatcher.yml b/docs/static/generated/rest_v1_dispatcher.yml index 7cf4e89c00bcf..669f33e403895 100644 --- a/docs/static/generated/rest_v1_dispatcher.yml +++ b/docs/static/generated/rest_v1_dispatcher.yml @@ -1994,13 +1994,6 @@ components: timezone-offset: type: integer format: int32 - DistributedCacheFile: - type: object - properties: - entryName: - type: string - fileName: - type: string EnvironmentInfo: type: object properties: diff --git a/docs/static/generated/rest_v4_sql_gateway.yml b/docs/static/generated/rest_v4_sql_gateway.yml new file mode 100644 index 0000000000000..59f5d26c50555 --- /dev/null +++ b/docs/static/generated/rest_v4_sql_gateway.yml @@ -0,0 +1,673 @@ +openapi: 3.0.1 +info: + title: Flink SQL Gateway REST API + contact: + email: user@flink.apache.org + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: v4/2.0-SNAPSHOT +paths: + /api_versions: + get: + description: Get the current available versions for the Rest Endpoint. The client + can choose one of the return version as the protocol for later communicate. + operationId: getApiVersion + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/GetApiVersionResponseBody' + /info: + get: + description: Get meta data for this cluster. + operationId: getInfo + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/GetInfoResponseBody' + /sessions: + post: + description: Opens a new session with specific properties. Specific properties + can be given for current session which will override the default properties + of gateway. + operationId: openSession + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenSessionRequestBody' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenSessionResponseBody' + /sessions/{session_handle}: + get: + description: Get the session configuration. + operationId: getSessionConfig + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/GetSessionConfigResponseBody' + delete: + description: Closes the specific session. + operationId: closeSession + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/CloseSessionResponseBody' + /sessions/{session_handle}/complete-statement: + get: + description: Get the completion hints for the given statement at the given position. + operationId: completeStatement + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteStatementRequestBody' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/CompleteStatementResponseBody' + /sessions/{session_handle}/configure-session: + post: + description: |- + Configures the session with the statement which could be: + CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE DATABASE, DROP DATABASE, ALTER DATABASE, CREATE FUNCTION, DROP FUNCTION, ALTER FUNCTION, CREATE CATALOG, DROP CATALOG, USE CATALOG, USE [CATALOG.]DATABASE, CREATE VIEW, DROP VIEW, LOAD MODULE, UNLOAD MODULE, USE MODULE, ADD JAR. + operationId: configureSession + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConfigureSessionRequestBody' + responses: + "200": + description: The request was successful. + /sessions/{session_handle}/heartbeat: + post: + description: "Trigger heartbeat to tell the server that the client is active,\ + \ and to keep the session alive as long as configured timeout value." + operationId: triggerSession + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + responses: + "200": + description: The request was successful. + /sessions/{session_handle}/operations/{operation_handle}/cancel: + post: + description: Cancel the operation. + operationId: cancelOperation + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + - name: operation_handle + in: path + description: The OperationHandle that identifies a operation. + required: true + schema: + $ref: '#/components/schemas/OperationHandle' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/OperationStatusResponseBody' + /sessions/{session_handle}/operations/{operation_handle}/close: + delete: + description: Close the operation. + operationId: closeOperation + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + - name: operation_handle + in: path + description: The OperationHandle that identifies a operation. + required: true + schema: + $ref: '#/components/schemas/OperationHandle' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/OperationStatusResponseBody' + /sessions/{session_handle}/operations/{operation_handle}/result/{token}: + get: + description: Fetch results of Operation. + operationId: fetchResults + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + - name: operation_handle + in: path + description: The OperationHandle that identifies a operation. + required: true + schema: + $ref: '#/components/schemas/OperationHandle' + - name: token + in: path + description: The token that identifies which batch of data to fetch. + required: true + schema: + type: integer + format: int64 + - name: rowFormat + in: query + description: The row format to serialize the RowData. + required: true + style: form + schema: + $ref: '#/components/schemas/RowFormat' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/FetchResultsResponseBody' + /sessions/{session_handle}/operations/{operation_handle}/status: + get: + description: Get the status of operation. + operationId: getOperationStatus + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + - name: operation_handle + in: path + description: The OperationHandle that identifies a operation. + required: true + schema: + $ref: '#/components/schemas/OperationHandle' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/OperationStatusResponseBody' + /sessions/{session_handle}/scripts: + post: + description: Deploy the script in application mode + operationId: deployScript + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeployScriptRequestBody' + responses: + "202": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/DeployScriptResponseBody' + /sessions/{session_handle}/statements: + post: + description: Execute a statement. + operationId: executeStatement + parameters: + - name: session_handle + in: path + description: The SessionHandle that identifies a session. + required: true + schema: + $ref: '#/components/schemas/SessionHandle' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ExecuteStatementRequestBody' + responses: + "200": + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/ExecuteStatementResponseBody' +components: + schemas: + CloseSessionResponseBody: + type: object + properties: + status: + type: string + Column: + type: object + properties: + comment: + type: string + dataType: + $ref: '#/components/schemas/DataType' + name: + type: string + persisted: + type: boolean + physical: + type: boolean + ColumnInfo: + type: object + properties: + comment: + type: string + logicalType: + $ref: '#/components/schemas/LogicalType' + name: + type: string + CompleteStatementRequestBody: + type: object + properties: + position: + type: integer + format: int32 + statement: + type: string + CompleteStatementResponseBody: + type: object + properties: + candidates: + type: array + items: + type: string + ConfigureSessionRequestBody: + type: object + properties: + executionTimeout: + type: integer + format: int64 + statement: + type: string + ConstraintType: + type: string + enum: + - PRIMARY_KEY + - UNIQUE_KEY + DataType: + type: object + properties: + children: + type: array + items: + $ref: '#/components/schemas/DataType' + logicalType: + $ref: '#/components/schemas/LogicalType' + DeployScriptRequestBody: + type: object + properties: + executionConfig: + type: object + additionalProperties: + type: string + script: + type: string + scriptPath: + type: string + DeployScriptResponseBody: + type: object + properties: + clusterID: + type: string + ExecuteStatementRequestBody: + type: object + properties: + executionConfig: + type: object + additionalProperties: + type: string + executionTimeout: + type: integer + format: int64 + statement: + type: string + ExecuteStatementResponseBody: + type: object + properties: + operationHandle: + type: string + Expression: + type: object + FetchResultsResponseBody: + type: object + properties: + jobID: + $ref: '#/components/schemas/JobID' + nextResultUri: + type: string + queryResult: + type: boolean + resultKind: + $ref: '#/components/schemas/ResultKind' + resultType: + $ref: '#/components/schemas/ResultType' + results: + $ref: '#/components/schemas/ResultInfo' + FieldGetter: + type: object + GetApiVersionResponseBody: + type: object + properties: + versions: + type: array + items: + type: string + GetInfoResponseBody: + type: object + properties: + productName: + type: string + version: + type: string + GetSessionConfigResponseBody: + type: object + properties: + properties: + type: object + additionalProperties: + type: string + IntermediateDataSetID: + pattern: "[0-9a-f]{32}" + type: string + JobID: + pattern: "[0-9a-f]{32}" + type: string + JobVertexID: + pattern: "[0-9a-f]{32}" + type: string + LogicalType: + type: object + properties: + children: + type: array + items: + $ref: '#/components/schemas/LogicalType' + nullable: + type: boolean + typeRoot: + $ref: '#/components/schemas/LogicalTypeRoot' + LogicalTypeRoot: + type: string + enum: + - CHAR + - VARCHAR + - BOOLEAN + - BINARY + - VARBINARY + - DECIMAL + - TINYINT + - SMALLINT + - INTEGER + - BIGINT + - FLOAT + - DOUBLE + - DATE + - TIME_WITHOUT_TIME_ZONE + - TIMESTAMP_WITHOUT_TIME_ZONE + - TIMESTAMP_WITH_TIME_ZONE + - TIMESTAMP_WITH_LOCAL_TIME_ZONE + - INTERVAL_YEAR_MONTH + - INTERVAL_DAY_TIME + - ARRAY + - MULTISET + - MAP + - ROW + - DISTINCT_TYPE + - STRUCTURED_TYPE + - "NULL" + - RAW + - SYMBOL + - UNRESOLVED + OpenSessionRequestBody: + type: object + properties: + properties: + type: object + additionalProperties: + type: string + sessionName: + type: string + OpenSessionResponseBody: + type: object + properties: + sessionHandle: + type: string + OperationHandle: + type: object + properties: + identifier: + type: string + format: uuid + OperationStatusResponseBody: + type: object + properties: + status: + type: string + RefreshMaterializedTableRequestBody: + type: object + properties: + dynamicOptions: + type: object + additionalProperties: + type: string + executionConfig: + type: object + additionalProperties: + type: string + isPeriodic: + type: boolean + periodic: + type: boolean + scheduleTime: + type: string + staticPartitions: + type: object + additionalProperties: + type: string + RefreshMaterializedTableResponseBody: + type: object + properties: + operationHandle: + type: string + ResolvedExpression: + type: object + properties: + children: + type: array + items: + $ref: '#/components/schemas/Expression' + outputDataType: + $ref: '#/components/schemas/DataType' + resolvedChildren: + type: array + items: + $ref: '#/components/schemas/ResolvedExpression' + ResolvedSchema: + type: object + properties: + columnCount: + type: integer + format: int32 + columnDataTypes: + type: array + items: + $ref: '#/components/schemas/DataType' + columnNames: + type: array + items: + type: string + columns: + type: array + items: + $ref: '#/components/schemas/Column' + primaryKey: + $ref: '#/components/schemas/UniqueConstraint' + primaryKeyIndexes: + type: array + items: + type: integer + format: int32 + watermarkSpecs: + type: array + items: + $ref: '#/components/schemas/WatermarkSpec' + ResourceID: + pattern: "[0-9a-f]{32}" + type: string + ResultInfo: + type: object + properties: + columnInfos: + type: array + items: + $ref: '#/components/schemas/ColumnInfo' + data: + type: array + items: + $ref: '#/components/schemas/RowData' + fieldGetters: + type: array + items: + $ref: '#/components/schemas/FieldGetter' + resultSchema: + $ref: '#/components/schemas/ResolvedSchema' + rowFormat: + $ref: '#/components/schemas/RowFormat' + ResultKind: + type: string + enum: + - SUCCESS + - SUCCESS_WITH_CONTENT + ResultType: + type: string + enum: + - NOT_READY + - PAYLOAD + - EOS + RowData: + type: object + properties: + arity: + type: integer + format: int32 + rowKind: + $ref: '#/components/schemas/RowKind' + RowFormat: + type: string + enum: + - JSON + - PLAIN_TEXT + RowKind: + type: string + enum: + - INSERT + - UPDATE_BEFORE + - UPDATE_AFTER + - DELETE + SerializedThrowable: + type: object + properties: + serialized-throwable: + type: string + format: binary + SessionHandle: + type: object + properties: + identifier: + type: string + format: uuid + TriggerId: + pattern: "[0-9a-f]{32}" + type: string + UniqueConstraint: + type: object + properties: + columns: + type: array + items: + type: string + enforced: + type: boolean + name: + type: string + type: + $ref: '#/components/schemas/ConstraintType' + WatermarkSpec: + type: object + properties: + rowtimeAttribute: + type: string + watermarkExpression: + $ref: '#/components/schemas/ResolvedExpression' diff --git a/flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/header/application/DeployScriptHeaders.java b/flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/header/application/DeployScriptHeaders.java index 2a3dba12ba4e4..703e4dde5f646 100644 --- a/flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/header/application/DeployScriptHeaders.java +++ b/flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/header/application/DeployScriptHeaders.java @@ -83,4 +83,9 @@ public String getTargetRestEndpointURL() { public Collection> getSupportedAPIVersions() { return SqlGatewayRestAPIVersion.getHigherVersions(SqlGatewayRestAPIVersion.V3); } + + @Override + public String operationId() { + return "deployScript"; + } }