Executes Spark SQL statements in batches.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| adb:ExecuteSparkWarehouseBatchSQL | none | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| Agency | string | No | The name of the client. | DataWorks |
| DBClusterId | string | Yes | The cluster ID. | amv-bp11q28kvl688**** |
| ResourceGroupName | string | Yes | The name of the resource group. | test |
| Query | string | Yes | The SQL statements that you want to execute in batches. Separate multiple SQL statements with semicolons (;). The execution engine executes the SQL statements in sequence in the same session. | CREATE TABLE user(id INT, name STRING); INSERT INTO t VALUE(1, 'Bob'); SELECT * FROM t; |
| Schema | string | No | The name of the database. | adb_demo |
| ExecuteResultLimit | long | No | The maximum amount of execution result data that can be written to Object Storage Service (OSS). Unit: MB. Default value: 4096. The size of compressed objects is difficult to estimate. The data that is actually written to OSS is smaller than the specified value. | 4096 |
| ExecuteTimeLimitInSeconds | long | No | The maximum execution duration. Unit: seconds. If a set of SQL statements fail to be executed for the specified period of time after submission, they are marked as a timeout error. The default value is 360000 seconds, which is equivalent to 100 hours. | 3600000 |
| RuntimeConfig | string | No | The additional runtime parameter. Specify the parameter in the JSON format. | { "OSSURL": "oss://testBucketname/" } |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "CBE843D8-964D-5EA3-9D31-822125611B6E",
"Data": {
"QueryId": "sq172352176****",
"QueryState": "RUNNING",
"QuerySubmissionTime": 1723521767000,
"QueryStartTime": 1723521767000,
"QueryEndTime": 1723521767000,
"Schema": "default",
"Uid": 0,
"DBClusterId": "amv-bp17s73f016****",
"ResourceGroupName": "spark_rg",
"Query": "SELECT * FROM db.tb",
"Statements": [
{
"ResultUri": "oss://yourbucket/result.json",
"EndTime": 1723521767000,
"AppId": "s20240122jsdx****",
"StatementId": "sq1723521767****-0001",
"State": "RUNNING",
"StartTime": 1723521767000,
"Error": "table is not found",
"Code": "SELECT 100",
"Result": "+---+-----+\n|age| name|\n+---+-----+\n| 14| Tom|\n| 23|Alice|\n+---+-----+"
}
],
"ErrMessage": "schema is not found"
}
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | Spark.InvalidParameter | Invalid parameter value: %s | Incorrect input parameter:%s. |
| 400 | Spark.InvalidState | The object of the operation is in an invalid state: %s | The operation object is invalid. |
| 404 | Spark.ObjectNotFound | The object is not found. More information: %s | - |
| 500 | Spark.ServerError | The Spark control component system encountered an error, please create a ticket to solve the problem or concat the supported engineer on duty. Error message: %s | An error occurred on the Spark control component system. Submit a ticket or contact technical support. |
For a list of error codes, visit the Service error codes.
