public class AggregateUniqueRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.aggregateUnique
.
Returns all the unique values from a particular column (specified by columnName
) of a particular table or view (specified by
tableName
). If columnName
is a numeric column, the values will be in data
. Otherwise if
columnName
is a string column, the values will be
in jsonEncodedResponse
. The results can be paged via offset
and 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 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
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 columnName
, 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 of columnName
is an unrestricted-length string.
Modifier and Type | Class and Description |
---|---|
static class |
AggregateUniqueRequest.Encoding
A set of string constants for the
AggregateUniqueRequest
parameter encoding . |
static class |
AggregateUniqueRequest.Options
A set of string constants for the
AggregateUniqueRequest
parameter options . |
Constructor and Description |
---|
AggregateUniqueRequest()
Constructs an AggregateUniqueRequest object with default parameters.
|
AggregateUniqueRequest(String tableName,
String columnName,
long offset,
long limit,
Map<String,String> options)
Constructs an AggregateUniqueRequest object with the specified
parameters.
|
AggregateUniqueRequest(String tableName,
String columnName,
long offset,
long limit,
String encoding,
Map<String,String> options)
Constructs an AggregateUniqueRequest object with the specified
parameters.
|
Modifier and Type | Method and Description | ||
---|---|---|---|
boolean |
equals(Object obj) |
||
Object |
get(int index)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
||
static org.apache.avro.Schema |
getClassSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
||
String |
getColumnName()
Name of the column or an expression containing one or more column names
on which the unique function would be applied.
|
||
String |
getEncoding()
Specifies the encoding for returned records.
|
||
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.
|
||
long |
getOffset()
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.Schema |
getSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
||
String |
getTableName()
Name of an existing table or view on which the operation will be
performed, in [schema_name.]table_name format, using standard
int hashCode() | ||
void |
put(int index,
Object value)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
||
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.
|
||
AggregateUniqueRequest |
setEncoding(String encoding)
Specifies the encoding for returned records.
|
||
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.
|
||
AggregateUniqueRequest |
setOffset(long offset)
A positive integer indicating the number of initial results to skip
(this can be useful for paging through the results).
|
||
AggregateUniqueRequest |
setOptions(Map<String,String> options)
Optional parameters.
|
||
AggregateUniqueRequest |
setTableName(String tableName)
|
public AggregateUniqueRequest()
public AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, Map<String,String> options)
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. Use hasMoreRecords
to see if more records exist in the result
to be fetched, and offset
& limit
to
request subsequent pages of results. The default value is
-9999.options
- Optional parameters.
CREATE_TEMP_TABLE
: If TRUE
, a unique temporary table name will be
generated in the sys_temp schema and used in
place of RESULT_TABLE
. If RESULT_TABLE_PERSIST
is FALSE
(or unspecified), then this is always
allowed even if the caller does not have
permission to create tables. The generated name
is returned in QUALIFIED_RESULT_TABLE_NAME
.
Supported values:
The default value is FALSE
.
COLLECTION_NAME
:
[DEPRECATED--please specify the containing
schema as part of RESULT_TABLE
and use GPUdb.createSchema
to create the schema if
non-existent] Name of a schema which is to
contain the table specified in RESULT_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 is ASCENDING
.
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 if columnName
is an unrestricted-length string.
RESULT_TABLE_PERSIST
: If TRUE
, then the result table specified in RESULT_TABLE
will be
persisted and will not expire unless a TTL
is specified. If FALSE
, then the result table will
be an in-memory table and will expire unless a
TTL
is specified otherwise.
Supported values:
The default value is FALSE
.
RESULT_TABLE_FORCE_REPLICATED
: Force the result
table to be replicated (ignores any sharding).
Must be used in combination with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
RESULT_TABLE_GENERATE_PK
: If TRUE
then set a primary key for
the result table. Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of the table specified in
RESULT_TABLE
.
CHUNK_SIZE
: Indicates
the number of records per chunk to be used for
the result table. Must be used in combination
with the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
VIEW_ID
: ID of view of
which the result table will be a member. The
default value is ''.
Map
.public AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, String encoding, Map<String,String> options)
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. Use hasMoreRecords
to see if more records exist in the result
to be fetched, and offset
& limit
to
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
: If TRUE
, a unique temporary table name will be
generated in the sys_temp schema and used in
place of RESULT_TABLE
. If RESULT_TABLE_PERSIST
is FALSE
(or unspecified), then this is always
allowed even if the caller does not have
permission to create tables. The generated name
is returned in QUALIFIED_RESULT_TABLE_NAME
.
Supported values:
The default value is FALSE
.
COLLECTION_NAME
:
[DEPRECATED--please specify the containing
schema as part of RESULT_TABLE
and use GPUdb.createSchema
to create the schema if
non-existent] Name of a schema which is to
contain the table specified in RESULT_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 is ASCENDING
.
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 if columnName
is an unrestricted-length string.
RESULT_TABLE_PERSIST
: If TRUE
, then the result table specified in RESULT_TABLE
will be
persisted and will not expire unless a TTL
is specified. If FALSE
, then the result table will
be an in-memory table and will expire unless a
TTL
is specified otherwise.
Supported values:
The default value is FALSE
.
RESULT_TABLE_FORCE_REPLICATED
: Force the result
table to be replicated (ignores any sharding).
Must be used in combination with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
RESULT_TABLE_GENERATE_PK
: If TRUE
then set a primary key for
the result table. Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of the table specified in
RESULT_TABLE
.
CHUNK_SIZE
: Indicates
the number of records per chunk to be used for
the result table. Must be used in combination
with the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
VIEW_ID
: ID of view of
which the result table will be a member. The
default value is ''.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getTableName()
tableName
.public AggregateUniqueRequest setTableName(String tableName)
tableName
- The new value for tableName
.this
to mimic the builder pattern.public String getColumnName()
columnName
.public AggregateUniqueRequest setColumnName(String columnName)
columnName
- The new value for columnName
.this
to mimic the builder pattern.public long getOffset()
offset
.public AggregateUniqueRequest setOffset(long offset)
offset
- The new value for offset
.this
to mimic the builder pattern.public long getLimit()
hasMoreRecords
to see if more records exist in the result to be
fetched, and offset
& limit
to
request subsequent pages of results. The default value is -9999.limit
.public AggregateUniqueRequest setLimit(long limit)
hasMoreRecords
to see if more records exist in the result to be
fetched, and offset
& limit
to
request subsequent pages of results. The default value is -9999.limit
- The new value for limit
.this
to mimic the builder pattern.public String getEncoding()
BINARY
: Indicates that the returned
records should be binary encoded.
JSON
: Indicates that the returned records
should be json encoded.
BINARY
.encoding
.public AggregateUniqueRequest setEncoding(String encoding)
BINARY
: Indicates that the returned
records should be binary encoded.
JSON
: Indicates that the returned records
should be json encoded.
BINARY
.encoding
- The new value for encoding
.this
to mimic the builder pattern.public Map<String,String> getOptions()
CREATE_TEMP_TABLE
: If TRUE
, a unique temporary table name will be
generated in the sys_temp schema and used in place of RESULT_TABLE
. If RESULT_TABLE_PERSIST
is FALSE
(or unspecified), then this is always
allowed even if the caller does not have permission to create
tables. The generated name is returned in QUALIFIED_RESULT_TABLE_NAME
.
Supported values:
The default value is FALSE
.
COLLECTION_NAME
:
[DEPRECATED--please specify the containing schema as part of
RESULT_TABLE
and use GPUdb.createSchema
to create the schema if non-existent] Name
of a schema which is to contain the table specified in RESULT_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 is ASCENDING
.
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 if columnName
is an unrestricted-length string.
RESULT_TABLE_PERSIST
: If
TRUE
, then the result table specified in
RESULT_TABLE
will be persisted and
will not expire unless a TTL
is specified.
If FALSE
, then the result table will be an
in-memory table and will expire unless a TTL
is specified otherwise.
Supported values:
The default value is FALSE
.
RESULT_TABLE_FORCE_REPLICATED
: Force the result table to be
replicated (ignores any sharding). Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
RESULT_TABLE_GENERATE_PK
: If TRUE
then set
a primary key for the result table. Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of
the table specified in RESULT_TABLE
.
CHUNK_SIZE
: Indicates the number of
records per chunk to be used for the result table. Must be used
in combination with the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
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 the
RESULT_TABLE
option.
VIEW_ID
: ID of view of which the result
table will be a member. The default value is ''.
Map
.options
.public AggregateUniqueRequest setOptions(Map<String,String> options)
CREATE_TEMP_TABLE
: If TRUE
, a unique temporary table name will be
generated in the sys_temp schema and used in place of RESULT_TABLE
. If RESULT_TABLE_PERSIST
is FALSE
(or unspecified), then this is always
allowed even if the caller does not have permission to create
tables. The generated name is returned in QUALIFIED_RESULT_TABLE_NAME
.
Supported values:
The default value is FALSE
.
COLLECTION_NAME
:
[DEPRECATED--please specify the containing schema as part of
RESULT_TABLE
and use GPUdb.createSchema
to create the schema if non-existent] Name
of a schema which is to contain the table specified in RESULT_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 is ASCENDING
.
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 if columnName
is an unrestricted-length string.
RESULT_TABLE_PERSIST
: If
TRUE
, then the result table specified in
RESULT_TABLE
will be persisted and
will not expire unless a TTL
is specified.
If FALSE
, then the result table will be an
in-memory table and will expire unless a TTL
is specified otherwise.
Supported values:
The default value is FALSE
.
RESULT_TABLE_FORCE_REPLICATED
: Force the result table to be
replicated (ignores any sharding). Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
RESULT_TABLE_GENERATE_PK
: If TRUE
then set
a primary key for the result table. Must be used in combination
with the RESULT_TABLE
option.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of
the table specified in RESULT_TABLE
.
CHUNK_SIZE
: Indicates the number of
records per chunk to be used for the result table. Must be used
in combination with the RESULT_TABLE
option.
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 the RESULT_TABLE
option.
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 the
RESULT_TABLE
option.
VIEW_ID
: ID of view of which the result
table will be a member. The default value is ''.
Map
.options
- The new value for options
.this
to mimic the builder pattern.public org.apache.avro.Schema getSchema()
getSchema
in interface org.apache.avro.generic.GenericContainer
public Object get(int index)
get
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to getIndexOutOfBoundsException
public void put(int index, Object value)
put
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to setvalue
- the value to setIndexOutOfBoundsException
Copyright © 2025. All rights reserved.