Executes multiple Spark SQL statements in a single batch request.
Operation description
-
Public endpoint of a region:
adb.<region-id>.aliyuncs.com. Example:adb.cn-hangzhou.aliyuncs.com. -
VPC endpoint of a region:
adb-vpc.<region-id>.aliyuncs.com. Example:adb-vpc.cn-hangzhou.aliyuncs.com.
If you receive a 409 error when sending requests from the China (Qingdao), China (Shenzhen), China (Guangzhou), or China (Hong Kong) region, contact technical support.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
adb:ExecuteSparkWarehouseBatchSQL |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Agency |
string |
No |
The client name. |
Dataworks. |
| DBClusterId |
string |
Yes |
The cluster ID. |
amv-bp11q28kvl688**** |
| ResourceGroupName |
string |
Yes |
The resource group name. |
test |
| Query |
string |
Yes |
The SQL statements to execute in batches. Separate multiple SQL statements with semicolons (;). The execution engine runs the statements sequentially within the same session. |
CREATE TABLE user(id INT, name STRING); INSERT INTO t VALUE(1, 'Bob'); SELECT * FROM t; |
| Schema |
string |
No |
The database name. |
adb_demo |
| ExecuteResultLimit |
integer |
No |
The maximum size of execution result data that can be written to Object Storage Service (OSS). Unit: MB. Default value: 4096. Because compressed object sizes are difficult to estimate, the actual data written to OSS is smaller than the specified value. |
4096 |
| ExecuteTimeLimitInSeconds |
integer |
No |
The maximum execution duration. Unit: seconds. If SQL statements are not completed within the specified period after submission, they are marked as a timeout error. Default value: 360000 (equivalent to 100 hours). |
3600000 |
| RuntimeConfig |
string |
No |
The additional runtime parameters in JSON format. |
{ "OSSURL": "oss://testBucketname/" } |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The request ID. |
CBE843D8-964D-5EA3-9D31-822125611B6E |
| Data | SparkBatchSQL |
The returned data. |
true |
Examples
Success response
JSON format
{
"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. |
| 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. |
| 404 | Spark.ObjectNotFound | The object is not found. More information: %s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.