public class AggregateUnpivotRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.aggregateUnpivot
.
Rotate the column values into rows values.
For unpivot details and examples, see Unpivot. For limitations, see Unpivot Limitations.
Unpivot is used to normalize tables that are built for cross tabular reporting purposes. The unpivot operator rotates the column values for all the pivoted columns. A variable column, value column and all columns from the source table except the unpivot columns are projected into the result table. The variable column and value columns in the result table indicate the pivoted column name and values respectively.
The response is returned as a dynamic schema. For details see: dynamic schemas documentation.
Modifier and Type | Class and Description |
---|---|
static class |
AggregateUnpivotRequest.Encoding
A set of string constants for the
AggregateUnpivotRequest
parameter encoding . |
static class |
AggregateUnpivotRequest.Options
A set of string constants for the
AggregateUnpivotRequest
parameter options . |
Constructor and Description |
---|
AggregateUnpivotRequest()
Constructs an AggregateUnpivotRequest object with default parameters.
|
AggregateUnpivotRequest(String tableName,
List<String> columnNames,
String variableColumnName,
String valueColumnName,
List<String> pivotedColumns,
Map<String,String> options)
Constructs an AggregateUnpivotRequest object with the specified
parameters.
|
AggregateUnpivotRequest(String tableName,
List<String> columnNames,
String variableColumnName,
String valueColumnName,
List<String> pivotedColumns,
String encoding,
Map<String,String> options)
Constructs an AggregateUnpivotRequest 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.
|
List<String> |
getColumnNames()
List of column names or expressions.
|
String |
getEncoding()
Specifies the encoding for returned records.
|
Map<String,String> |
getOptions()
Optional parameters.
|
List<String> |
getPivotedColumns()
List of one or more values typically the column names of the input
table.
|
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 the table on which the operation will be performed.
|
String |
getValueColumnName()
Specifies the value column name.
|
String |
getVariableColumnName()
Specifies the variable/parameter column name.
|
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.
|
AggregateUnpivotRequest |
setColumnNames(List<String> columnNames)
List of column names or expressions.
|
AggregateUnpivotRequest |
setEncoding(String encoding)
Specifies the encoding for returned records.
|
AggregateUnpivotRequest |
setOptions(Map<String,String> options)
Optional parameters.
|
AggregateUnpivotRequest |
setPivotedColumns(List<String> pivotedColumns)
List of one or more values typically the column names of the input
table.
|
AggregateUnpivotRequest |
setTableName(String tableName)
Name of the table on which the operation will be performed.
|
AggregateUnpivotRequest |
setValueColumnName(String valueColumnName)
Specifies the value column name.
|
AggregateUnpivotRequest |
setVariableColumnName(String variableColumnName)
Specifies the variable/parameter column name.
|
String |
toString() |
public AggregateUnpivotRequest()
public AggregateUnpivotRequest(String tableName, List<String> columnNames, String variableColumnName, String valueColumnName, List<String> pivotedColumns, Map<String,String> options)
tableName
- Name of the table on which the operation will be
performed. Must be an existing table/view, in
[schema_name.]table_name format, using standard name resolution rules.columnNames
- List of column names or expressions. A wildcard '*'
can be used to include all the non-pivoted columns
from the source table.variableColumnName
- Specifies the variable/parameter column name.
The default value is ''.valueColumnName
- Specifies the value column name. The default
value is ''.pivotedColumns
- List of one or more values typically the column
names of the input table. All the columns in the
source table must have the same data type.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 is non-existent, it will be automatically
created.
RESULT_TABLE
: The
name of a 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.
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
.
EXPRESSION
: Filter
expression to apply to the table prior to
unpivot processing.
ORDER_BY
:
Comma-separated list of the columns to be sorted
by; e.g. 'timestamp asc, x desc'. The columns
specified must be present in input table. If
any alias is given for any column name, the
alias must be used, rather than the original
column name. The default value is ''.
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.
LIMIT
: The number of
records to keep. The default value is ''.
TTL
: Sets the TTL of the table specified in
RESULT_TABLE
.
VIEW_ID
: view this
result table is part of. The default value is
''.
CREATE_INDEXES
:
Comma-separated list of columns on which to
create indexes on the table specified in RESULT_TABLE
. The columns
specified must be present in output column
names. If any alias is given for any column
name, the alias must be used, rather than the
original column name.
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
.
Map
.public AggregateUnpivotRequest(String tableName, List<String> columnNames, String variableColumnName, String valueColumnName, List<String> pivotedColumns, String encoding, Map<String,String> options)
tableName
- Name of the table on which the operation will be
performed. Must be an existing table/view, in
[schema_name.]table_name format, using standard name resolution rules.columnNames
- List of column names or expressions. A wildcard '*'
can be used to include all the non-pivoted columns
from the source table.variableColumnName
- Specifies the variable/parameter column name.
The default value is ''.valueColumnName
- Specifies the value column name. The default
value is ''.pivotedColumns
- List of one or more values typically the column
names of the input table. All the columns in the
source table must have the same data type.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 is non-existent, it will be automatically
created.
RESULT_TABLE
: The
name of a 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.
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
.
EXPRESSION
: Filter
expression to apply to the table prior to
unpivot processing.
ORDER_BY
:
Comma-separated list of the columns to be sorted
by; e.g. 'timestamp asc, x desc'. The columns
specified must be present in input table. If
any alias is given for any column name, the
alias must be used, rather than the original
column name. The default value is ''.
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.
LIMIT
: The number of
records to keep. The default value is ''.
TTL
: Sets the TTL of the table specified in
RESULT_TABLE
.
VIEW_ID
: view this
result table is part of. The default value is
''.
CREATE_INDEXES
:
Comma-separated list of columns on which to
create indexes on the table specified in RESULT_TABLE
. The columns
specified must be present in output column
names. If any alias is given for any column
name, the alias must be used, rather than the
original column name.
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
.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getTableName()
tableName
.public AggregateUnpivotRequest setTableName(String tableName)
tableName
- The new value for tableName
.this
to mimic the builder pattern.public List<String> getColumnNames()
columnNames
.public AggregateUnpivotRequest setColumnNames(List<String> columnNames)
columnNames
- The new value for columnNames
.this
to mimic the builder pattern.public String getVariableColumnName()
variableColumnName
.public AggregateUnpivotRequest setVariableColumnName(String variableColumnName)
variableColumnName
- The new value for variableColumnName
.this
to mimic the builder pattern.public String getValueColumnName()
valueColumnName
.public AggregateUnpivotRequest setValueColumnName(String valueColumnName)
valueColumnName
- The new value for valueColumnName
.this
to mimic the builder pattern.public List<String> getPivotedColumns()
pivotedColumns
.public AggregateUnpivotRequest setPivotedColumns(List<String> pivotedColumns)
pivotedColumns
- The new value for pivotedColumns
.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 AggregateUnpivotRequest 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 is
non-existent, it will be automatically created.
RESULT_TABLE
: The name of a 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.
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
.
EXPRESSION
: Filter expression to
apply to the table prior to unpivot processing.
ORDER_BY
: Comma-separated list of the
columns to be sorted by; e.g. 'timestamp asc, x desc'. The
columns specified must be present in input table. If any alias
is given for any column name, the alias must be used, rather
than the original column name. The default value is ''.
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.
LIMIT
: The number of records to keep. The
default value is ''.
TTL
: Sets the TTL of
the table specified in RESULT_TABLE
.
VIEW_ID
: view this result table is part
of. The default value is ''.
CREATE_INDEXES
: Comma-separated
list of columns on which to create indexes on the table
specified in RESULT_TABLE
. The
columns specified must be present in output column names. If
any alias is given for any column name, the alias must be used,
rather than the original column name.
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
.
Map
.options
.public AggregateUnpivotRequest 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 is
non-existent, it will be automatically created.
RESULT_TABLE
: The name of a 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.
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
.
EXPRESSION
: Filter expression to
apply to the table prior to unpivot processing.
ORDER_BY
: Comma-separated list of the
columns to be sorted by; e.g. 'timestamp asc, x desc'. The
columns specified must be present in input table. If any alias
is given for any column name, the alias must be used, rather
than the original column name. The default value is ''.
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.
LIMIT
: The number of records to keep. The
default value is ''.
TTL
: Sets the TTL of
the table specified in RESULT_TABLE
.
VIEW_ID
: view this result table is part
of. The default value is ''.
CREATE_INDEXES
: Comma-separated
list of columns on which to create indexes on the table
specified in RESULT_TABLE
. The
columns specified must be present in output column names. If
any alias is given for any column name, the alias must be used,
rather than the original column name.
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
.
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.