URL: http://GPUDB_IP_ADDRESS:GPUDB_PORT/aggregate/unique
Returns all the unique values from a particular column (specified by input parameter column_name) of a particular table or collection (specified by input parameter table_name). If input parameter column_name is a numeric column the values will be in output parameter binary_encoded_response. Otherwise if input parameter column_name is a string column the values will be in output parameter json_encoded_response. The results can be paged via the input parameter offset and input parameter limit parameters.
Columns marked as store-only are unable to be used with this function.
To get the first 10 unique values sorted in descending order input parameter options would be:
{"limit":"10","sort_order":"descending"}.
The response is returned as a dynamic schema. For details see: dynamic schemas documentation.
If a result_table name is specified in the input parameter options, the results are stored in a new table with that name--no results are returned in the response. Both the table name and resulting column name must adhere to standard naming conventions; any column expression will need to be aliased. If the source table's shard key is used as the input parameter column_name, the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available if input parameter table_name is a collection or when the value of input parameter column_name is an unrestricted-length string.
Name | Type | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table_name | string | Name of an existing table/collection on which the operation will be performed. | ||||||||||||||||||||||
column_name | string | Name of the column or an expression containing one or more column names on which the unique function would be applied. | ||||||||||||||||||||||
offset | long | A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The minimum allowed value is 0. The maximum allowed value is MAX_INT. | ||||||||||||||||||||||
limit | long | A positive integer indicating the maximum number of results to be returned. Or END_OF_SET (-9999) to indicate that the max number of results should be returned. The default value is 10000. | ||||||||||||||||||||||
encoding | string | Specifies the encoding for returned records.
|
||||||||||||||||||||||
options | map of string to strings | Optional parameters. The default value is an empty map ( {} ).
|
The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
status | String | 'OK' or 'ERROR' | ||||||||||||||||||
message | String | Empty if success or an error message | ||||||||||||||||||
data_type | String | 'aggregate_unique_request' or 'none' in case of an error | ||||||||||||||||||
data | String | Empty string | ||||||||||||||||||
data_str | JSON or String | This embedded JSON represents the result of the /aggregate/unique endpoint:
Empty string in case of an error. |