GPUdb.aggregate_unique( table_name = None, column_name = None, offset = None,
limit = 10000, encoding = 'binary', options = {} )
Returns all the unique values from a particular column (specified by input parameter column_name) of a particular table (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. input parameter offset and input parameter limit are used to page through the results if there are large numbers of unique values. 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 the 'result_table' option is provided then the results are stored in a table with the name given in the option and the results are not returned in the response.
Input Parameter Description
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
table_name | str | Name of the table on which the operation will be performed. Must be a valid table in GPUdb. | ||||||||
column_name | str | 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. Default value is 10000. | ||||||||
encoding | str | Specifies the encoding for returned records. Default value is 'binary'.
|
||||||||
options | dict of str | Optional parameters. Default value is an empty dict ( {} ).
|
Output Parameter Description
Name | Type | Description |
---|---|---|
table_name | str | The same table name as was passed in the parameter list. |
response_schema_str | str | Avro schema of output parameter binary_encoded_response or output parameter json_encoded_response. |
binary_encoded_response | str | Avro binary encoded response. |
json_encoded_response | str | Avro JSON encoded response. |
has_more_records | bool | Too many records. Returned a partial set. |