Updated on 2026-11-06 GMT+08:00

Viewing SparkSql Job Details

Function

This API is used to view the detailed information of a SparkSql job. It is synchronous. It returns job status, SQL content, execution parameters, etc. After a successful call, the job details are returned directly. You can create a job by calling the API for running a Spark SQL job and query the job list by calling the API for listing Spark SQL jobs.

Calling Method

For details, see Calling APIs.

URI

GET /v2/workspaces/{workspace_id}/spark-sqls/{statement_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID, used for resource isolation. This can be viewed on the workspace page of the console.

Constraints: N/A

Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

statement_id

Yes

String

Definition: Spark SQL job ID, used to uniquely identify a SparkSql job execution. It can be obtained from the statement_id in the response of the API for executing a Spark SQL job or from the API for listing Spark SQL jobs.

Constraints: N/A

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: The value can contain a maximum of 65,534 characters, with no character type restrictions.

Default Value: N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

endpoint_name

String

Definition: Endpoint name, used to specify the SparkSql execution environment.

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit.

endpoint_id

String

Definition: Endpoint ID, which uniquely identifies the SparkSql execution environment.

Range: UUID format, 36 characters.

client_token

String

Definition: SparkSql job transaction ID, used to prevent duplicate submissions.

Range: UUID format, 36 characters. Example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

catalog_context

SparkSqlCatalogContextResponse object

Definition: Catalog context information, used to specify the data catalog and database used by the job.

statement

String

Definition: User SQL statement, used to perform tasks such as data query and data manipulation.

Range: Up to 500,000 characters.

parameters

Array of SparkSqlParameter objects

Definition: List of placeholder parameters for user SQL content, used to dynamically replace parameters in the SQL. Each element in the array is a SparkSqlParameter object, which contains the key and value of a placeholder.

statement_type

String

Definition: SQL job type, used to identify the type of the job.

Range

  • DDL: Jobs for creating, modifying, or deleting metadata, including DESC/SHOW statements.

  • DCL: Jobs for permission granting and revocation.

  • DQL: Query statements (SELECT).

  • DML: Jobs for appending, deleting, or updating data in tables.

statement_id

String

Definition: Spark SQL job ID, used to uniquely identify a Spark SQL job execution.

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed. Example: 80ceaaff-3cfc-4162-a56f-70031ea4fa91.

state

String

Definition: SparkSql job status, used to identify the execution status of the job.

Range

  • QUEUED: Queued.

  • RUNNING: Running.

  • CANCELING: Canceling.

  • CANCELED: Canceled.

  • FAILED: Failed.

  • QUEUED_TIMEOUT: Queue timeout.

  • RUNNING_TIMEOUT: Running timeout.

  • SUCCEED: Succeeded.

error

SparkSqlErrorDto object

Definition: SparkSql job error details, containing error description, error code, and other information.

spark_config

Map<String,String>

Definition: User-defined Spark parameter configuration, used to configure Spark parameters during job execution. The key in the map is the Spark configuration item name (for example, spark.executor.memory), and the value is the corresponding configuration value. Both key and value are strings.

image

ShowSparkSqlImageConfigResponse object

Definition: Image configuration information, including image ID and version information.

result

SparkSqlResultResponse object

Definition: SparkSql job result information, including the format and path of the query results.

metric_statistics

SparkSqlMetricStatisticsResponse object

Definition: SparkSql job metric statistics, including the amount of data read, data output, and compute resource usage.

timeout

SparkSqlTimeout object

Definition: SparkSql job timeout configuration information, including queue timeout and running timeout durations.

log_url

String

Definition: Log OBS archive path, used to store job execution log information.

Range: OBS path format, for example, obs://bucket/aidatalake/workspace_{workspace_id}/spark/endpoint_{endpoint_id}/jobs/logs/{yyyy_MM_dd}/sql-engine-{engine_id}/spark_{app_name}-driver_spark-sql-{endpoint_id}/spark.log. The path is automatically generated and does not need to be constructed. {workspace_id} indicates the workspace ID, {endpoint_id} indicates the endpoint ID, {yyyy_MM_dd} indicates the date, {engine_id} indicates the SQL engine ID, and {app_name} indicates the Spark application name.

create_time

Long

Definition: Job creation time, used to identify the creation timestamp of the job.

Range: Integer greater than or equal to 0, in milliseconds.

start_time

Long

Definition: Job start time, used to identify the timestamp when the job started execution.

Range: Integer greater than or equal to 0, in milliseconds.

end_time

Long

Definition: Job end time, used to identify the timestamp when the job completed execution.

Range: Integer greater than or equal to 0, in milliseconds.

create_user

SparkCreateUser object

Definition: Information about the user who creates the job.

labels

Array of SparkSqlLabelRes objects

Definition: Job tag list, used to identify and categorize jobs. Each element in the array is a SparkSqlLabelRes object, which contains the key and value of a tag.

Table 4 SparkSqlCatalogContextResponse

Parameter

Type

Description

catalog_name

String

Definition: Catalog name, used to specify the data catalog used by the job.

Range: The value can contain a maximum of 128 characters, with no character type restrictions.

database_name

String

Definition: Default database name, used to specify the database used by the job.

Range: The value can contain a maximum of 128 characters, with no character type restrictions.

Table 5 SparkSqlParameter

Parameter

Type

Description

key

String

Definition: Placeholder key, used to identify the parameter position in the SQL statement. Example: :key in a SQL statement.

Range: The value can contain 1 to 128 characters, with no character type restrictions.

value

String

Definition: Placeholder value, used to replace the placeholder in the SQL statement. The value must be a string, and the format is determined by value_type. The input formats of DATE and TIMESTAMP are the same (Unix timestamp in milliseconds), but they are converted to different data types.

Range: 1 to 512 characters.

value_type

String

Definition: Placeholder type, used to identify the data type of the placeholder value.

Range

  • STRING: String type.

  • DECIMAL: Fixed-point number type.

  • INTEGER: Integer type.

  • DATE: Date type.

  • TIMESTAMP: Timestamp type.

Table 6 SparkSqlErrorDto

Parameter

Type

Description

message

String

Definition: SparkSql error description, used to explain the specific cause of the error.

Range: 1 to 1,024 characters. Example: Table does not exist.

sql_state

String

Definition: SparkSql error code, used to identify the type of error.

Range: Standard SQL error code format. Example: 42P01.

error_class

String

Definition: SparkSql error type, used to identify the category of the error.

Range: 1 to 128 characters. Example: SCHEMA_ALREADY_EXISTS.

line

Integer

Definition: Error line number, used to locate the error position in the SQL statement.

Range: Integer greater than 0. Example: 2.

start_position

Integer

Definition: Error start position, used to locate the starting character position of the error in the SQL statement.

Range: Integer greater than 0. Example: 2.

Table 7 ShowSparkSqlImageConfigResponse

Parameter

Type

Description

release_version

String

Definition: Version information of the Spark SQL cluster (AIDataLake.xxx(Spark x.xx.x, JRE x.xx.x)).

Range: 1 to 512 characters.

image_version_type

String

Definition: Image version type used by the SparkSql cluster.

Range

  • STABLE: Stable.

  • RECOMMEND: Recommended.

  • BETA: Beta.

Table 8 SparkSqlResultResponse

Parameter

Type

Description

result_format

String

Definition: Query SQL result format, used to specify the storage format of the results.

Range

  • csv: CSV format.

  • arrow: Apache Arrow format.

result_path

String

Definition: OBS path for query SQL results, used to store the result data of the SQL query.

Range: OBS path format, for example, obs://bucket/aidatalake/workspace_{workspace_id}/spark/endpoint_{endpoint_id}/jobs/sql_result/{engine_id}/{yyyy_MM_dd}/{statement_id}/result. The path is automatically generated and does not need to be constructed. {workspace_id} indicates the workspace ID, {endpoint_id} indicates the endpoint ID, {engine_id} indicates the SQL engine ID, {yyyy_MM_dd} indicates the date, and {statement_id} indicates the job ID.

result_records

Long

Definition: Number of rows in the query result, indicating the number of data rows returned by the SQL query.

Range: Integer greater than or equal to 0.

result_bytes

Long

Definition: Number of bytes in the query result, indicating the size of the data returned by the SQL query.

Range: Integer greater than or equal to 0, in bytes.

execution_profile_path

String

Definition: Storage path for the job execution plan, used to store the execution plan information of the job.

Range: OBS path format, for example, obs://bucket/aidatalake/workspace_{workspace_id}/spark/endpoint_{endpoint_id}/jobs/sql_profile/{engine_id}/{yyyy_MM_dd}/{statement_id}/profile. The path is automatically generated and does not need to be constructed. {workspace_id} indicates the workspace ID, {endpoint_id} indicates the endpoint ID, {engine_id} indicates the SQL engine ID, {yyyy_MM_dd} indicates the date, and {statement_id} indicates the job ID.

Table 9 SparkSqlMetricStatisticsResponse

Parameter

Type

Description

bad_records

Long

Definition: Number of dirty data rows, used to identify the number of erroneous data rows found during processing.

Range: Integer greater than or equal to 0.

input_bytes

Long

Definition: Number of data bytes read, used to identify the amount of data read by the job.

Range: Integer greater than or equal to 0, in bytes.

input_records

Long

Definition: Number of data rows read, used to identify the number of data records read by the job.

Range: Integer greater than or equal to 0.

output_bytes

Long

Definition: Number of data bytes output, used to identify the amount of data output by the job.

Range: Integer greater than or equal to 0, in bytes.

output_records

Long

Definition: Number of data rows output, used to identify the number of data records output by the job.

Range: Integer greater than or equal to 0.

cpu_time

Long

Definition: CPU seconds used for computation, used to identify the compute resources consumed by the job.

Range: Integer greater than or equal to 0, in seconds.

Table 10 SparkSqlTimeout

Parameter

Type

Description

queued_timeout

Integer

Definition: Job queue timeout duration, in minutes. If the job has not started running after this time, the job will be marked as queue timeout and fail.

Range: 10 to 180 minutes.

running_timeout

Integer

Definition: Job running timeout duration, in minutes. If the job has not completed after this time, the job will be canceled and marked as running timeout.

Range: 10 to 720 minutes.

Table 11 SparkCreateUser

Parameter

Type

Description

user_id

String

Definition: User ID of the job creator, used to identify the job creator.

Range: The value can contain 1 to 256 characters, with no character type restrictions.

user_name

String

Definition: User name of the job creator, used to identify the job creator.

Range: The value can contain 1 to 256 characters, with no character type restrictions.

Table 12 SparkSqlLabelRes

Parameter

Type

Description

key

String

Definition: Tag key, used to identify the type or category of the tag.

Range: 1 to 128 characters.

value

String

Definition: Tag value, used to identify the specific content or attribute of the tag.

Range: 1 to 512 characters.

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 401

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 403

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 500

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Example Requests

View the complete detailed information of a specified SparkSql job, including SQL content, execution parameters, and status.

GET /v2/workspaces/{workspace_id}/spark-sqls/{statement_id}

Example Responses

Status code: 200

{
  "statement_id" : "6c98db52-cac2-4ff1-9a91-b7793e95557d",
  "client_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "endpoint_name" : "spark-endpoint-01",
  "catalog_context" : {
    "catalog_name" : "hive_catalog",
    "database_name" : "default"
  },
  "statement" : "SELECT * FROM table_name WHERE id = :id_param LIMIT 100",
  "parameters" : [ {
    "key" : "id_param",
    "value" : "12345",
    "value_type" : "INTEGER"
  } ],
  "state" : "SUCCEED",
  "statement_type" : "DQL",
  "spark_config" : {
    "spark.executor.memory" : "4g",
    "spark.executor.cores" : "2"
  },
  "result" : {
    "result_format" : "csv",
    "result_path" : "obs://my-bucket/aidatalake/workspace_a1b2c3d4e5f6470a9c1b8d2e3f4a5b6c/spark/endpoint_9f8e7d6c5b4a39281706f5e4d3c2b1a0/jobs/sql_result/019e19fb78887b57b2f6c4174cd5a002/2026_06_01/6c98db52-cac2-4ff1-9a91-b7793e95557d/result",
    "execution_profile_path" : "obs://my-bucket/aidatalake/workspace_a1b2c3d4e5f6470a9c1b8d2e3f4a5b6c/spark/endpoint_9f8e7d6c5b4a39281706f5e4d3c2b1a0/jobs/sql_profile/019e19fb78887b57b2f6c4174cd5a002/2026_06_01/6c98db52-cac2-4ff1-9a91-b7793e95557d/profile"
  },
  "metric_statistics" : {
    "bad_records" : 0,
    "input_bytes" : 1048576,
    "input_records" : 1000,
    "output_bytes" : 524288,
    "output_records" : 500,
    "cpu_time" : 3000
  },
  "timeout" : {
    "queued_timeout" : 180,
    "running_timeout" : 720
  },
  "log_url" : "obs://my-bucket/aidatalake/workspace_a1b2c3d4e5f6470a9c1b8d2e3f4a5b6c/spark/endpoint_9f8e7d6c5b4a39281706f5e4d3c2b1a0/jobs/logs/2026_04_27/sql-engine-6c98db52/spark_ai-datalake-spark-sql-engine-6c98db52-driver_spark-sql-9f8e7d6c/spark.log",
  "create_time" : 1698776400000,
  "start_time" : 1698776450000,
  "end_time" : 1698776700000,
  "create_user" : {
    "user_id" : "user123",
    "user_name" : "admin"
  },
  "labels" : [ {
    "key" : "env",
    "value" : "production"
  } ]
}

Status code: 400

{
  "error_code" : "AIDataLake.01011001",
  "error_msg" : "Invalid parameter statement_id",
  "solution_msg" : "Please check the input parameters according to the documentation(statement_id for spark sql)."
}

Status code: 401

{
  "error_code" : "AIDataLake.01011003",
  "error_msg" : "auth token not exists in header",
  "solution_msg" : "Please check if auth token is included in the request header."
}

Status code: 403

{
  "error_code" : "AIDataLake.01011005",
  "error_msg" : "current account has no permission",
  "solution_msg" : "Please connect administrators to add permission."
}

Status code: 500

{
  "error_code" : "AIDataLake.01010001",
  "error_msg" : "Internal system error",
  "solution_msg" : "Contact operations for analysis."
}

Status Codes

Status Code

Description

200

SparkSql job details are successfully viewed.

400

Invalid request parameter.

401

Authentication failed.

403

Insufficient permissions.

500

Internal server error.