GetAutoClusterSuggestion

Updated at:

Queries the current clustering configuration, recommended configuration, and estimated shuffle benefits of a specified table. You can view the corresponding table modification SQL statement when a recommendation is available.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

odps:GetAutoClusterSuggestion

get

*Project

acs:odps:{#regionId}:{#accountId}:projects/{#ProjectName}

None None

Request syntax

GET /api/v1/projects/{project}/tables/{table}/autoCluster/suggestion HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

project

string

Yes

The name of the MaxCompute project.

analytics_prod

table

string

Yes

The name of the MaxCompute table.

order_detail

Request parameters

Parameter

Type

Required

Description

Example

date

string

No

The date of the analysis batch in the yyyyMMdd format. If this parameter is not specified, the latest batch of the corresponding dataset is used.

20251123

schema

string

No

The name of the schema to which the table belongs.

sales

Response elements

Element

Type

Description

Example

object

PopResult

requestId

string

The unique identifier of the API request. You can provide this identifier when troubleshooting call issues.

0be3e0aa16667684362147582e038f

httpCode

integer

The HTTP status code of the request.

200

errorCode

string

The error code returned when the request fails.

InvalidArgument

errorMsg

string

The error message returned when the request fails.

The specified parameter is invalid.

data

object

The result of querying automatic clustering recommendations for the table.

project

string

The name of the MaxCompute project.

analytics_prod

schema

string

The name of the schema to which the table belongs.

sales

table

string

The name of the MaxCompute table.

order_detail

clusterType

string

The clustering type. For example, hash indicates hash clustering.

hash

clusterKey

array

The list of cluster key column names.

string

The column name of a cluster key.

customer_id

sortKey

array

The list of sort column names within the cluster.

string

The column name of a sort key.

customer_id

bucketNum

integer

The number of buckets in the cluster.

32

partition

string

The names of the partition columns of the table. Multiple column names are separated by commas.

ds,region

suggestClusterType

string

The recommended clustering type. hash indicates hash clustering.

hash

suggestClusterKey

array

The list of recommended cluster key column names.

string

The column name recommended to be used as a cluster key.

customer_id

suggestSortKey

array

The list of recommended sort column names within the cluster.

string

The column name recommended to be used as a sort key within the cluster.

customer_id

suggestBucketNum

integer

The recommended number of buckets in the cluster.

32

savedReadShuffle

number

The estimated amount of read shuffle data saved after the recommendation is applied, in GB.

10.5

increasedWriteShuffle

number

The estimated amount of write shuffle data increased after the recommendation is applied, in GB.

0.75

savedShuffle

number

The estimated net amount of shuffle data saved, in GB. This is calculated by subtracting the increased write shuffle data from the saved read shuffle data.

9.75

savedReadCu deprecated

number

[Deprecated] This field is deprecated and is no longer returned. Do not rely on it. The example is only used to illustrate the data type.

12.5

increasedWriteCu deprecated

number

[Deprecated] This field is deprecated and is no longer returned. Do not rely on it. The example is only used to illustrate the data type.

2.5

savedCu deprecated

number

[Deprecated] This field is deprecated and is no longer returned. Do not rely on it. The example is only used to illustrate the data type.

8.5

savedTime deprecated

number

[Deprecated] This field is deprecated and is no longer returned. Do not rely on it. The example is only used to illustrate the data type.

15.5

benefitJobCount deprecated

integer

[Deprecated] This field is deprecated and is no longer returned. Do not rely on it. The example is only used to illustrate the data type.

24

readInstanceList

array

The list of read job instance IDs associated with the evaluation of this recommendation.

string

The instance ID of the read job.

20251123081031234g8x2p2m

writeInstanceList

array

The list of write job instance IDs associated with the evaluation of this recommendation.

string

The instance ID of the write job.

20251123082031234g8x2p2m

alterTableSql

string

The table modification SQL statement used to apply the recommendation.

ALTER TABLE order_detail CLUSTERED BY (customer_id) SORTED BY (customer_id) INTO 32 BUCKETS;

partitionScanList

array

The list of table partitions involved in the recommendation analysis.

string

The identifier of the table partition involved in the analysis.

ds=20251123

applied

boolean

Specifies whether the current table configuration is consistent with the recommendation. The clustering type, number of buckets, cluster key, and sort key are compared.

Examples

Success response

JSON format

{
  "requestId": "0be3e0aa16667684362147582e038f",
  "httpCode": 200,
  "errorCode": "InvalidArgument",
  "errorMsg": "The specified parameter is invalid.",
  "data": {
    "project": "analytics_prod",
    "schema": "sales",
    "table": "order_detail",
    "clusterType": "hash",
    "clusterKey": [
      "customer_id"
    ],
    "sortKey": [
      "customer_id"
    ],
    "bucketNum": 32,
    "partition": "ds,region",
    "suggestClusterType": "hash",
    "suggestClusterKey": [
      "customer_id"
    ],
    "suggestSortKey": [
      "customer_id"
    ],
    "suggestBucketNum": 32,
    "savedReadShuffle": 10.5,
    "increasedWriteShuffle": 0.75,
    "savedShuffle": 9.75,
    "savedReadCu": 12.5,
    "increasedWriteCu": 2.5,
    "savedCu": 8.5,
    "savedTime": 15.5,
    "benefitJobCount": 24,
    "readInstanceList": [
      "20251123081031234g8x2p2m"
    ],
    "writeInstanceList": [
      "20251123082031234g8x2p2m"
    ],
    "alterTableSql": "ALTER TABLE order_detail CLUSTERED BY (customer_id) SORTED BY (customer_id) INTO 32 BUCKETS;",
    "partitionScanList": [
      "ds=20251123"
    ],
    "applied": false
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.