Class AggregateUniqueRequest
- java.lang.Object
-
- com.gpudb.protocol.AggregateUniqueRequest
-
- All Implemented Interfaces:
org.apache.avro.generic.GenericContainer,org.apache.avro.generic.IndexedRecord
public class AggregateUniqueRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters forGPUdb.aggregateUnique.Returns all the unique values from a particular column (specified by
columnName) of a particular table or view (specified bytableName). IfcolumnNameis a numeric column, the values will be indata. Otherwise ifcolumnNameis a string column, the values will be injsonEncodedResponse. The results can be paged viaoffsetandlimitparameters.Columns marked as store-only are unable to be used with this function.
To get the first 10 unique values sorted in descending order
optionswould be:{"limit":"10","sort_order":"descending"}The response is returned as a dynamic schema. For details see: dynamic schemas documentation.If a
RESULT_TABLEname is specified in theoptions, 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 thecolumnName, 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 the value ofcolumnNameis an unrestricted-length string.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAggregateUniqueRequest.EncodingA set of string constants for theAggregateUniqueRequestparameterencoding.static classAggregateUniqueRequest.OptionsA set of string constants for theAggregateUniqueRequestparameteroptions.
-
Constructor Summary
Constructors Constructor Description AggregateUniqueRequest()Constructs an AggregateUniqueRequest object with default parameters.AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, String encoding, Map<String,String> options)Constructs an AggregateUniqueRequest object with the specified parameters.AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, Map<String,String> options)Constructs an AggregateUniqueRequest object with the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Objectget(int index)This method supports the Avro framework and is not intended to be called directly by the user.static org.apache.avro.SchemagetClassSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetColumnName()Name of the column or an expression containing one or more column names on which the unique function would be applied.StringgetEncoding()Specifies the encoding for returned records.longgetLimit()A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned.longgetOffset()A positive integer indicating the number of initial results to skip (this can be useful for paging through the results).Map<String,String>getOptions()Optional parameters.org.apache.avro.SchemagetSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetTableName()Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.inthashCode()voidput(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.AggregateUniqueRequestsetColumnName(String columnName)Name of the column or an expression containing one or more column names on which the unique function would be applied.AggregateUniqueRequestsetEncoding(String encoding)Specifies the encoding for returned records.AggregateUniqueRequestsetLimit(long limit)A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned.AggregateUniqueRequestsetOffset(long offset)A positive integer indicating the number of initial results to skip (this can be useful for paging through the results).AggregateUniqueRequestsetOptions(Map<String,String> options)Optional parameters.AggregateUniqueRequestsetTableName(String tableName)Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.StringtoString()
-
-
-
Constructor Detail
-
AggregateUniqueRequest
public AggregateUniqueRequest()
Constructs an AggregateUniqueRequest object with default parameters.
-
AggregateUniqueRequest
public AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, Map<String,String> options)
Constructs an AggregateUniqueRequest object with the specified parameters.- Parameters:
tableName- Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.columnName- Name of the column or an expression containing one or more column names on which the unique function would be applied.offset- A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT.limit- A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the max_get_records_size parameter in the server configuration. UsehasMoreRecordsto see if more records exist in the result to be fetched, andoffsetandlimitto request subsequent pages of results. The default value is -9999.options- Optional parameters.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place ofRESULT_TABLE. IfRESULT_TABLE_PERSISTisFALSE(or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_RESULT_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part ofRESULT_TABLEand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the table specified inRESULT_TABLE. If the schema provided is non-existent, it will be automatically created.EXPRESSION: Optional filter expression to apply to the table.SORT_ORDER: String indicating how the returned values should be sorted. Supported values: The default value isASCENDING.ORDER_BY: Comma-separated list of the columns to be sorted by as well as the sort direction, e.g., 'timestamp asc, x desc'. The default value is ''.RESULT_TABLE: The name of the table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If present, no results are returned in the response. Not available ifcolumnNameis an unrestricted-length string.RESULT_TABLE_PERSIST: IfTRUE, then the result table specified inRESULT_TABLEwill be persisted and will not expire unless aTTLis specified. IfFALSE, then the result table will be an in-memory table and will expire unless aTTLis specified otherwise. Supported values: The default value isFALSE.RESULT_TABLE_FORCE_REPLICATED: Force the result table to be replicated (ignores any sharding). Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.RESULT_TABLE_GENERATE_PK: IfTRUEthen set a primary key for the result table. Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified inRESULT_TABLE.CHUNK_SIZE: Indicates the number of records per chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.COMPRESSION_CODEC: The default compression codec for the result table's columns.VIEW_ID: ID of view of which the result table will be a member. The default value is ''.
Map.
-
AggregateUniqueRequest
public AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, String encoding, Map<String,String> options)
Constructs an AggregateUniqueRequest object with the specified parameters.- Parameters:
tableName- Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.columnName- Name of the column or an expression containing one or more column names on which the unique function would be applied.offset- A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT.limit- A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the max_get_records_size parameter in the server configuration. UsehasMoreRecordsto see if more records exist in the result to be fetched, andoffsetandlimitto request subsequent pages of results. The default value is -9999.encoding- Specifies the encoding for returned records. Supported values:BINARY: Indicates that the returned records should be binary encoded.JSON: Indicates that the returned records should be json encoded.
BINARY.options- Optional parameters.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place ofRESULT_TABLE. IfRESULT_TABLE_PERSISTisFALSE(or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_RESULT_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part ofRESULT_TABLEand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the table specified inRESULT_TABLE. If the schema provided is non-existent, it will be automatically created.EXPRESSION: Optional filter expression to apply to the table.SORT_ORDER: String indicating how the returned values should be sorted. Supported values: The default value isASCENDING.ORDER_BY: Comma-separated list of the columns to be sorted by as well as the sort direction, e.g., 'timestamp asc, x desc'. The default value is ''.RESULT_TABLE: The name of the table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If present, no results are returned in the response. Not available ifcolumnNameis an unrestricted-length string.RESULT_TABLE_PERSIST: IfTRUE, then the result table specified inRESULT_TABLEwill be persisted and will not expire unless aTTLis specified. IfFALSE, then the result table will be an in-memory table and will expire unless aTTLis specified otherwise. Supported values: The default value isFALSE.RESULT_TABLE_FORCE_REPLICATED: Force the result table to be replicated (ignores any sharding). Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.RESULT_TABLE_GENERATE_PK: IfTRUEthen set a primary key for the result table. Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified inRESULT_TABLE.CHUNK_SIZE: Indicates the number of records per chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.COMPRESSION_CODEC: The default compression codec for the result table's columns.VIEW_ID: ID of view of which the result table will be a member. The default value is ''.
Map.
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Returns:
- The schema for the class.
-
getTableName
public String getTableName()
Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.- Returns:
- The current value of
tableName.
-
setTableName
public AggregateUniqueRequest setTableName(String tableName)
Name of an existing table or view on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.- Parameters:
tableName- The new value fortableName.- Returns:
thisto mimic the builder pattern.
-
getColumnName
public String getColumnName()
Name of the column or an expression containing one or more column names on which the unique function would be applied.- Returns:
- The current value of
columnName.
-
setColumnName
public AggregateUniqueRequest setColumnName(String columnName)
Name of the column or an expression containing one or more column names on which the unique function would be applied.- Parameters:
columnName- The new value forcolumnName.- Returns:
thisto mimic the builder pattern.
-
getOffset
public long getOffset()
A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT.- Returns:
- The current value of
offset.
-
setOffset
public AggregateUniqueRequest setOffset(long offset)
A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT.- Parameters:
offset- The new value foroffset.- Returns:
thisto mimic the builder pattern.
-
getLimit
public long getLimit()
A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the max_get_records_size parameter in the server configuration. UsehasMoreRecordsto see if more records exist in the result to be fetched, andoffsetandlimitto request subsequent pages of results. The default value is -9999.- Returns:
- The current value of
limit.
-
setLimit
public AggregateUniqueRequest setLimit(long limit)
A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the max_get_records_size parameter in the server configuration. UsehasMoreRecordsto see if more records exist in the result to be fetched, andoffsetandlimitto request subsequent pages of results. The default value is -9999.- Parameters:
limit- The new value forlimit.- Returns:
thisto mimic the builder pattern.
-
getEncoding
public String getEncoding()
Specifies the encoding for returned records. Supported values:BINARY: Indicates that the returned records should be binary encoded.JSON: Indicates that the returned records should be json encoded.
BINARY.- Returns:
- The current value of
encoding.
-
setEncoding
public AggregateUniqueRequest setEncoding(String encoding)
Specifies the encoding for returned records. Supported values:BINARY: Indicates that the returned records should be binary encoded.JSON: Indicates that the returned records should be json encoded.
BINARY.- Parameters:
encoding- The new value forencoding.- Returns:
thisto mimic the builder pattern.
-
getOptions
public Map<String,String> getOptions()
Optional parameters.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place ofRESULT_TABLE. IfRESULT_TABLE_PERSISTisFALSE(or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_RESULT_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part ofRESULT_TABLEand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the table specified inRESULT_TABLE. If the schema provided is non-existent, it will be automatically created.EXPRESSION: Optional filter expression to apply to the table.SORT_ORDER: String indicating how the returned values should be sorted. Supported values: The default value isASCENDING.ORDER_BY: Comma-separated list of the columns to be sorted by as well as the sort direction, e.g., 'timestamp asc, x desc'. The default value is ''.RESULT_TABLE: The name of the table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If present, no results are returned in the response. Not available ifcolumnNameis an unrestricted-length string.RESULT_TABLE_PERSIST: IfTRUE, then the result table specified inRESULT_TABLEwill be persisted and will not expire unless aTTLis specified. IfFALSE, then the result table will be an in-memory table and will expire unless aTTLis specified otherwise. Supported values: The default value isFALSE.RESULT_TABLE_FORCE_REPLICATED: Force the result table to be replicated (ignores any sharding). Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.RESULT_TABLE_GENERATE_PK: IfTRUEthen set a primary key for the result table. Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified inRESULT_TABLE.CHUNK_SIZE: Indicates the number of records per chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.COMPRESSION_CODEC: The default compression codec for the result table's columns.VIEW_ID: ID of view of which the result table will be a member. The default value is ''.
Map.- Returns:
- The current value of
options.
-
setOptions
public AggregateUniqueRequest setOptions(Map<String,String> options)
Optional parameters.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place ofRESULT_TABLE. IfRESULT_TABLE_PERSISTisFALSE(or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_RESULT_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part ofRESULT_TABLEand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the table specified inRESULT_TABLE. If the schema provided is non-existent, it will be automatically created.EXPRESSION: Optional filter expression to apply to the table.SORT_ORDER: String indicating how the returned values should be sorted. Supported values: The default value isASCENDING.ORDER_BY: Comma-separated list of the columns to be sorted by as well as the sort direction, e.g., 'timestamp asc, x desc'. The default value is ''.RESULT_TABLE: The name of the table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If present, no results are returned in the response. Not available ifcolumnNameis an unrestricted-length string.RESULT_TABLE_PERSIST: IfTRUE, then the result table specified inRESULT_TABLEwill be persisted and will not expire unless aTTLis specified. IfFALSE, then the result table will be an in-memory table and will expire unless aTTLis specified otherwise. Supported values: The default value isFALSE.RESULT_TABLE_FORCE_REPLICATED: Force the result table to be replicated (ignores any sharding). Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.RESULT_TABLE_GENERATE_PK: IfTRUEthen set a primary key for the result table. Must be used in combination with theRESULT_TABLEoption. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified inRESULT_TABLE.CHUNK_SIZE: Indicates the number of records per chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for the result table. Must be used in combination with theRESULT_TABLEoption.COMPRESSION_CODEC: The default compression codec for the result table's columns.VIEW_ID: ID of view of which the result table will be a member. The default value is ''.
Map.- Parameters:
options- The new value foroptions.- Returns:
thisto mimic the builder pattern.
-
getSchema
public org.apache.avro.Schema getSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getSchemain interfaceorg.apache.avro.generic.GenericContainer- Returns:
- The schema object describing this class.
-
get
public Object get(int index)
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to get- Returns:
- value of the field with the given index.
- Throws:
IndexOutOfBoundsException
-
put
public void put(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
putin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to setvalue- the value to set- Throws:
IndexOutOfBoundsException
-
-