public class AggregateUniqueRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.aggregateUniqueRaw(AggregateUniqueRequest)
.
Returns all the unique values from a particular column (specified by columnName
) of a particular table or collection (specified by tableName
). If columnName
is a numeric column the values will be in
binaryEncodedResponse
. Otherwise if columnName
is a string
column the values will be in jsonEncodedResponse
. The results can
be paged via the 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 tableName
is a collection or when the value of columnName
is an unrestricted-length string.
Modifier and Type | Class and Description |
---|---|
static class |
AggregateUniqueRequest.Encoding
Specifies the encoding for returned records.
|
static class |
AggregateUniqueRequest.Options
Optional parameters.
|
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() |
String |
getEncoding() |
long |
getLimit() |
long |
getOffset() |
Map<String,String> |
getOptions() |
org.apache.avro.Schema |
getSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getTableName() |
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) |
AggregateUniqueRequest |
setEncoding(String encoding) |
AggregateUniqueRequest |
setLimit(long limit) |
AggregateUniqueRequest |
setOffset(long offset) |
AggregateUniqueRequest |
setOptions(Map<String,String> options) |
AggregateUniqueRequest |
setTableName(String tableName) |
String |
toString() |
public AggregateUniqueRequest()
public AggregateUniqueRequest(String tableName, String columnName, long offset, long limit, Map<String,String> options)
tableName
- Name of an existing table/collection on which the
operation will be performed.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 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 max number of results should be returned. The
default value is 10000.options
- Optional parameters.
COLLECTION_NAME
: Name of a collection which is to
contain the table specified in result_table
. If
the collection provided is non-existent, the collection
will be automatically created. If empty, then the table
will be a top-level table. Additionally this option is
invalid if tableName
is a collection.
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
.
RESULT_TABLE
: The name of the table used to store the
results. If present, no results are returned in the
response. Has the same naming restrictions as tables. Not available if tableName
is a collection or when 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 chunk size to be used for the
result table. Must be used in combination with the
result_table
option.
VIEW_ID
: view this result table is part of. 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/collection on which the
operation will be performed.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 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 max number of results should be returned. The
default value is 10000.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.
COLLECTION_NAME
: Name of a collection which is to
contain the table specified in result_table
. If
the collection provided is non-existent, the collection
will be automatically created. If empty, then the table
will be a top-level table. Additionally this option is
invalid if tableName
is a collection.
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
.
RESULT_TABLE
: The name of the table used to store the
results. If present, no results are returned in the
response. Has the same naming restrictions as tables. Not available if tableName
is a collection or when 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 chunk size to be used for the
result table. Must be used in combination with the
result_table
option.
VIEW_ID
: view this result table is part of. The
default value is ''.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getTableName()
public AggregateUniqueRequest setTableName(String tableName)
tableName
- Name of an existing table/collection on which the
operation will be performed.this
to mimic the builder pattern.public String getColumnName()
public AggregateUniqueRequest setColumnName(String columnName)
columnName
- Name of the column or an expression containing one or
more column names on which the unique function would
be applied.this
to mimic the builder pattern.public long getOffset()
public AggregateUniqueRequest setOffset(long offset)
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.this
to mimic the builder pattern.public long getLimit()
public AggregateUniqueRequest setLimit(long limit)
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. The
default value is 10000.this
to mimic the builder pattern.public String getEncoding()
public AggregateUniqueRequest setEncoding(String encoding)
public Map<String,String> getOptions()
COLLECTION_NAME
: Name of a collection which is to contain the
table specified in result_table
. If the collection
provided is non-existent, the collection will be automatically
created. If empty, then the table will be a top-level table.
Additionally this option is invalid if tableName
is a
collection.
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
.
RESULT_TABLE
: The name of the table used to store the results.
If present, no results are returned in the response. Has the
same naming restrictions as tables. Not available if tableName
is
a collection or when 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 chunk size to be used for the result
table. Must be used in combination with the result_table
option.
VIEW_ID
: view this result table is part of. The default value
is ''.
Map
.public AggregateUniqueRequest setOptions(Map<String,String> options)
options
- Optional parameters.
COLLECTION_NAME
: Name of a collection which is to
contain the table specified in result_table
. If
the collection provided is non-existent, the collection
will be automatically created. If empty, then the table
will be a top-level table. Additionally this option is
invalid if tableName
is a collection.
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
.
RESULT_TABLE
: The name of the table used to store the
results. If present, no results are returned in the
response. Has the same naming restrictions as tables. Not available if tableName
is a collection or when 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 chunk size to be used for the
result table. Must be used in combination with the
result_table
option.
VIEW_ID
: view this result table is part of. The
default value is ''.
Map
.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 © 2019. All rights reserved.