GPUdb C++ API  Version 6.0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
gpudb::AggregateGroupByRequest Struct Reference

A set of input parameters for const. More...

#include <gpudb/protocol/aggregate_group_by.h>

Public Member Functions

 AggregateGroupByRequest ()
 Constructs an AggregateGroupByRequest object with default parameter values. More...
 
 AggregateGroupByRequest (const std::string &tableName_, const std::vector< std::string > &columnNames_, const int64_t offset_, const int64_t limit_, const std::map< std::string, std::string > &options_)
 Constructs an AggregateGroupByRequest object with the specified parameters. More...
 
 AggregateGroupByRequest (const std::string &tableName_, const std::vector< std::string > &columnNames_, const int64_t offset_, const int64_t limit_, const std::string &encoding_, const std::map< std::string, std::string > &options_)
 Constructs an AggregateGroupByRequest object with the specified parameters. More...
 

Public Attributes

std::string tableName
 
std::vector< std::string > columnNames
 
int64_t offset
 
int64_t limit
 
std::string encoding
 
std::map< std::string,
std::string > 
options
 

Detailed Description

A set of input parameters for const.

Calculates unique combinations (groups) of values for the given columns in a given table/view/collection and computes aggregates on each unique combination. This is somewhat analogous to an SQL-style SELECT...GROUP BY.

Any column(s) can be grouped on, and all column types except unrestricted-length strings may be used for computing applicable aggregates; columns marked as store-only are unable to be used in grouping or aggregation.

The results can be paged via the offset and limit parameters. For example, to get 10 groups with the largest counts the inputs would be: limit=10, options={"sort_order":"descending", "sort_by":"value"}.

options can be used to customize behavior of this call e.g. filtering or sorting the results.

To group by columns 'x' and 'y' and compute the number of objects within each group, use: column_names=['x','y','count(*)'].

To also compute the sum of 'z' over each group, use: column_names=['x','y','count(*)','sum(z)'].

Available aggregation functions are: count(*), sum, min, max, avg, mean, stddev, stddev_pop, stddev_samp, var, var_pop, var_samp, arg_min, arg_max and count_distinct.

The response is returned as a dynamic schema. For details see: dynamic schemas documentation.

If a result_table name is specified in the 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 names must adhere to standard naming conventions; column/aggregation expressions will need to be aliased. If the source table's shard key is used as the grouping column(s), 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 when any of the values of columnNames is an unrestricted-length string.

Definition at line 66 of file aggregate_group_by.h.

Constructor & Destructor Documentation

gpudb::AggregateGroupByRequest::AggregateGroupByRequest ( )
inline

Constructs an AggregateGroupByRequest object with default parameter values.

Definition at line 73 of file aggregate_group_by.h.

gpudb::AggregateGroupByRequest::AggregateGroupByRequest ( const std::string &  tableName_,
const std::vector< std::string > &  columnNames_,
const int64_t  offset_,
const int64_t  limit_,
const std::map< std::string, std::string > &  options_ 
)
inline

Constructs an AggregateGroupByRequest object with the specified parameters.

Parameters
[in]tableName_Name of the table on which the operation will be performed. Must be an existing table/view/collection.
[in]columnNames_List of one or more column names, expressions, and aggregate expressions. Must include at least one 'grouping' column or expression. If no aggregate is included, count(*) will be computed as a default.
[in]offset_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.
[in]limit_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.
[in]options_Optional parameters.
  • gpudb::aggregate_group_by_collection_name: Name of a collection which is to contain the table specified in result_table, otherwise the table will be a top-level table. If the collection does not allow duplicate types and it contains a table of the same type as the given one, then this table creation request will fail. Additionally this option is invalid if tableName is a collection.
  • gpudb::aggregate_group_by_expression: Filter expression to apply to the table prior to computing the aggregate group by.
  • gpudb::aggregate_group_by_having: Filter expression to apply to the aggregated results.
  • gpudb::aggregate_group_by_sort_order: String indicating how the returned values should be sorted - ascending or descending.
  • gpudb::aggregate_group_by_sort_by: String determining how the results are sorted.
    • gpudb::aggregate_group_by_key: Indicates that the returned values should be sorted by key, which corresponds to the grouping columns. If you have multiple grouping columns (and are sorting by key), it will first sort the first grouping column, then the second grouping column, etc.
    • gpudb::aggregate_group_by_value: Indicates that the returned values should be sorted by value, which corresponds to the aggregates. If you have multiple aggregates (and are sorting by value), it will first sort by the first aggregate, then the second aggregate, etc.
  • gpudb::aggregate_group_by_result_table: The name of the table used to store the results. Has the same naming restrictions as tables. Column names (group-by and aggregate fields) need to be given aliases e.g. ["FChar256 as fchar256", "sum(FDouble) as sfd"]. If present, no results are returned in the response. This option is not available if one of the grouping attributes is an unrestricted string (i.e.; not charN) type.
  • gpudb::aggregate_group_by_result_table_persist: If true then the result table specified in result_table will be persisted as a regular table (it will not be automatically cleared unless a ttl is provided, and the table data can be modified in subsequent operations). If false then the result table will be a read-only, memory-only temporary table.
  • gpudb::aggregate_group_by_ttl: Sets the TTL of the table specified in result_table. The value must be the desired TTL in minutes.

Definition at line 189 of file aggregate_group_by.h.

gpudb::AggregateGroupByRequest::AggregateGroupByRequest ( const std::string &  tableName_,
const std::vector< std::string > &  columnNames_,
const int64_t  offset_,
const int64_t  limit_,
const std::string &  encoding_,
const std::map< std::string, std::string > &  options_ 
)
inline

Constructs an AggregateGroupByRequest object with the specified parameters.

Parameters
[in]tableName_Name of the table on which the operation will be performed. Must be an existing table/view/collection.
[in]columnNames_List of one or more column names, expressions, and aggregate expressions. Must include at least one 'grouping' column or expression. If no aggregate is included, count(*) will be computed as a default.
[in]offset_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.
[in]limit_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.
[in]encoding_Specifies the encoding for returned records.
[in]options_Optional parameters.
  • gpudb::aggregate_group_by_collection_name: Name of a collection which is to contain the table specified in result_table, otherwise the table will be a top-level table. If the collection does not allow duplicate types and it contains a table of the same type as the given one, then this table creation request will fail. Additionally this option is invalid if tableName is a collection.
  • gpudb::aggregate_group_by_expression: Filter expression to apply to the table prior to computing the aggregate group by.
  • gpudb::aggregate_group_by_having: Filter expression to apply to the aggregated results.
  • gpudb::aggregate_group_by_sort_order: String indicating how the returned values should be sorted - ascending or descending.
  • gpudb::aggregate_group_by_sort_by: String determining how the results are sorted.
    • gpudb::aggregate_group_by_key: Indicates that the returned values should be sorted by key, which corresponds to the grouping columns. If you have multiple grouping columns (and are sorting by key), it will first sort the first grouping column, then the second grouping column, etc.
    • gpudb::aggregate_group_by_value: Indicates that the returned values should be sorted by value, which corresponds to the aggregates. If you have multiple aggregates (and are sorting by value), it will first sort by the first aggregate, then the second aggregate, etc.
  • gpudb::aggregate_group_by_result_table: The name of the table used to store the results. Has the same naming restrictions as tables. Column names (group-by and aggregate fields) need to be given aliases e.g. ["FChar256 as fchar256", "sum(FDouble) as sfd"]. If present, no results are returned in the response. This option is not available if one of the grouping attributes is an unrestricted string (i.e.; not charN) type.
  • gpudb::aggregate_group_by_result_table_persist: If true then the result table specified in result_table will be persisted as a regular table (it will not be automatically cleared unless a ttl is provided, and the table data can be modified in subsequent operations). If false then the result table will be a read-only, memory-only temporary table.
  • gpudb::aggregate_group_by_ttl: Sets the TTL of the table specified in result_table. The value must be the desired TTL in minutes.

Definition at line 314 of file aggregate_group_by.h.

Member Data Documentation

std::vector<std::string> gpudb::AggregateGroupByRequest::columnNames

Definition at line 325 of file aggregate_group_by.h.

std::string gpudb::AggregateGroupByRequest::encoding

Definition at line 328 of file aggregate_group_by.h.

int64_t gpudb::AggregateGroupByRequest::limit

Definition at line 327 of file aggregate_group_by.h.

int64_t gpudb::AggregateGroupByRequest::offset

Definition at line 326 of file aggregate_group_by.h.

std::map<std::string, std::string> gpudb::AggregateGroupByRequest::options

Definition at line 329 of file aggregate_group_by.h.

std::string gpudb::AggregateGroupByRequest::tableName

Definition at line 324 of file aggregate_group_by.h.


The documentation for this struct was generated from the following file: