public class CreateProjectionRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.createProjection(CreateProjectionRequest)
.
Creates a new projection of an existing table. A projection represents a subset of the columns (potentially including derived columns) of a table.
Notes:
A moving average can be calculated on a given column using the following
syntax in the columnNames
parameter:
'moving_average(column_name,num_points_before,num_points_after) as new_column_name'
For each record in the moving_average function's 'column_name' parameter, it computes the average over the previous 'num_points_before' records and the subsequent 'num_points_after' records.
Note that moving average relies on order_by
, and order_by
requires that all the data being ordered resides on the same processing
node, so it won't make sense to use order_by
without moving average.
Also, a projection can be created with a different shard
key than the source table. By specifying shard_key
, the
projection will be sharded according to the specified columns, regardless of
how the source table is sharded. The source table can even be unsharded or
replicated.
Modifier and Type | Class and Description |
---|---|
static class |
CreateProjectionRequest.Options
Optional parameters.
|
Constructor and Description |
---|
CreateProjectionRequest()
Constructs a CreateProjectionRequest object with default parameters.
|
CreateProjectionRequest(String tableName,
String projectionName,
List<String> columnNames,
Map<String,String> options)
Constructs a CreateProjectionRequest 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() |
Map<String,String> |
getOptions() |
String |
getProjectionName() |
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.
|
CreateProjectionRequest |
setColumnNames(List<String> columnNames) |
CreateProjectionRequest |
setOptions(Map<String,String> options) |
CreateProjectionRequest |
setProjectionName(String projectionName) |
CreateProjectionRequest |
setTableName(String tableName) |
String |
toString() |
public CreateProjectionRequest()
public CreateProjectionRequest(String tableName, String projectionName, List<String> columnNames, Map<String,String> options)
tableName
- Name of the existing table on which the projection is
to be applied.projectionName
- Name of the projection to be created. Has the
same naming restrictions as tables.columnNames
- List of columns from tableName
to be
included in the projection. Can include derived
columns. Can be specified as aliased via the syntax
'column_name as alias'.options
- Optional parameters.
COLLECTION_NAME
: Name of a collection to which the projection is
to be assigned as a child. If the collection provided is
non-existent, the collection will be automatically
created.
EXPRESSION
: An optional filter expression to be applied to the source
table prior to the projection.
LIMIT
: The number of records to keep.
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 columnNames
. If
any alias is given for any column name, the alias must
be used, rather than the original column name.
MATERIALIZE_ON_GPU
: If true
then the columns of
the projection will be cached on the GPU.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of the table, view, or collection
specified in projectionName
. The value must be
the desired TTL in minutes.
SHARD_KEY
: Comma-separated list of the columns to be
sharded on; e.g. 'column1, column2'. The columns
specified must be present in columnNames
. If
any alias is given for any column name, the alias must
be used, rather than the original column name.
PERSIST
: If true
then the projection 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 projection will
be a read-only, memory-only temporary table.
Supported values:
The default value is FALSE
.
public static org.apache.avro.Schema getClassSchema()
public String getTableName()
public CreateProjectionRequest setTableName(String tableName)
tableName
- Name of the existing table on which the projection is
to be applied.this
to mimic the builder pattern.public String getProjectionName()
public CreateProjectionRequest setProjectionName(String projectionName)
projectionName
- Name of the projection to be created. Has the
same naming restrictions as tables.this
to mimic the builder pattern.public List<String> getColumnNames()
tableName
to be included in the
projection. Can include derived columns. Can be specified as
aliased via the syntax 'column_name as alias'.public CreateProjectionRequest setColumnNames(List<String> columnNames)
columnNames
- List of columns from tableName
to be
included in the projection. Can include derived
columns. Can be specified as aliased via the syntax
'column_name as alias'.this
to mimic the builder pattern.public Map<String,String> getOptions()
COLLECTION_NAME
: Name of a collection to which the projection is to be
assigned as a child. If the collection provided is non-existent,
the collection will be automatically created.
EXPRESSION
: An optional filter expression to be applied to the source table
prior to the projection.
LIMIT
:
The number of records to keep.
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 columnNames
. If any alias is given for any
column name, the alias must be used, rather than the original
column name.
MATERIALIZE_ON_GPU
: If true
then the columns of the
projection will be cached on the GPU.
Supported values:
The default value is FALSE
.
TTL
:
Sets the TTL of the table, view, or collection specified in
projectionName
. The value must be the desired TTL in
minutes.
SHARD_KEY
: Comma-separated list of the columns to be sharded
on; e.g. 'column1, column2'. The columns specified must be
present in columnNames
. If any alias is given for any
column name, the alias must be used, rather than the original
column name.
PERSIST
: If true
then the projection 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 projection
will be a read-only, memory-only temporary table.
Supported values:
The default value is FALSE
.
public CreateProjectionRequest setOptions(Map<String,String> options)
options
- Optional parameters.
COLLECTION_NAME
: Name of a collection to which the projection is
to be assigned as a child. If the collection provided is
non-existent, the collection will be automatically
created.
EXPRESSION
: An optional filter expression to be applied to the source
table prior to the projection.
LIMIT
: The number of records to keep.
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 columnNames
. If
any alias is given for any column name, the alias must
be used, rather than the original column name.
MATERIALIZE_ON_GPU
: If true
then the columns of
the projection will be cached on the GPU.
Supported values:
The default value is FALSE
.
TTL
: Sets the TTL of the table, view, or collection
specified in projectionName
. The value must be
the desired TTL in minutes.
SHARD_KEY
: Comma-separated list of the columns to be
sharded on; e.g. 'column1, column2'. The columns
specified must be present in columnNames
. If
any alias is given for any column name, the alias must
be used, rather than the original column name.
PERSIST
: If true
then the projection 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 projection will
be a read-only, memory-only temporary table.
Supported values:
The default value is FALSE
.
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 © 2017. All rights reserved.