public class AppendRecordsRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.appendRecords
.
Append (or insert) all records from a source table (specified by sourceTableName
) to a particular target table
(specified by tableName
). The field map (specified
by fieldMap
) holds the user specified map of target
table column names with their mapped source column names.
Modifier and Type | Class and Description |
---|---|
static class |
AppendRecordsRequest.Options
A set of string constants for the
AppendRecordsRequest parameter
options . |
Constructor and Description |
---|
AppendRecordsRequest()
Constructs an AppendRecordsRequest object with default parameters.
|
AppendRecordsRequest(String tableName,
String sourceTableName,
Map<String,String> fieldMap,
Map<String,String> options)
Constructs an AppendRecordsRequest 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.
|
||||
Map<String,String> |
getFieldMap()
Contains the mapping of column names from the target table (specified by
tableName ) as the keys, and corresponding column
names or expressions (e.g., 'col_name+1') from the source table
(specified by sourceTableName ). |
||||
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 |
getSourceTableName()
The source table name to get records from, in [schema_name.]table_name
format, using standard
String getTableName()
The table name for the records to be appended, 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.
|
||||
AppendRecordsRequest |
setFieldMap(Map<String,String> fieldMap)
Contains the mapping of column names from the target table (specified by
tableName ) as the keys, and corresponding column
names or expressions (e.g., 'col_name+1') from the source table
(specified by sourceTableName ). |
||||
AppendRecordsRequest |
setOptions(Map<String,String> options)
Optional parameters.
|
||||
AppendRecordsRequest |
setSourceTableName(String sourceTableName)
The source table name to get records from, in [schema_name.]table_name
format, using standard
AppendRecordsRequest setTableName(String tableName)
|
public AppendRecordsRequest()
public AppendRecordsRequest(String tableName, String sourceTableName, Map<String,String> fieldMap, Map<String,String> options)
tableName
- The table name for the records to be appended, in
[schema_name.]table_name format, using standard name resolution rules. Must be an
existing table.sourceTableName
- The source table name to get records from, in
[schema_name.]table_name format, using standard
name resolution rules. Must
be an existing table name.fieldMap
- Contains the mapping of column names from the target
table (specified by tableName
) as the keys, and
corresponding column names or expressions (e.g.,
'col_name+1') from the source table (specified by
sourceTableName
). Must be existing column names
in source table and target table, and their types must
be matched. For details on using expressions, see Expressions.options
- Optional parameters.
OFFSET
: A positive
integer indicating the number of initial results
to skip from sourceTableName
. Default is
0. The minimum allowed value is 0. The maximum
allowed value is MAX_INT. The default value is
'0'.
LIMIT
: A positive integer
indicating the maximum number of results to be
returned from sourceTableName
. Or
END_OF_SET (-9999) to indicate that the max
number of results should be returned. The
default value is '-9999'.
EXPRESSION
: Optional
filter expression to apply to the sourceTableName
. The default value is ''.
ORDER_BY
:
Comma-separated list of the columns to be sorted
by from source table (specified by sourceTableName
), e.g., 'timestamp asc, x
desc'. The ORDER_BY
columns do not have to be present in fieldMap
. The default value is ''.
UPDATE_ON_EXISTING_PK
: Specifies the record
collision policy for inserting source table
records (specified by sourceTableName
)
into a target table (specified by tableName
) with a primary key. If set to TRUE
, any existing table record
with primary key values that match those of a
source table record being inserted will be
replaced by that new record (the new data will
be "upserted"). If set to FALSE
, any existing table record with primary
key values that match those of a source table
record being inserted will remain unchanged,
while the source record will be rejected and an
error handled as determined by IGNORE_EXISTING_PK
.
If the specified table does not have a primary
key, then this option has no effect.
Supported values:
TRUE
: Upsert new
records when primary keys match existing
records
FALSE
: Reject new
records when primary keys match existing
records
FALSE
.
IGNORE_EXISTING_PK
: Specifies the record
collision error-suppression policy for inserting
source table records (specified by sourceTableName
) into a target table (specified
by tableName
) with a primary key, only used when
not in upsert mode (upsert mode is disabled when
UPDATE_ON_EXISTING_PK
is FALSE
). If set to TRUE
,
any source table record being inserted that is
rejected for having primary key values that
match those of an existing target table record
will be ignored with no error generated. If
FALSE
, the rejection of
any source table record for having primary key
values matching an existing target table record
will result in an error being raised. If the
specified table does not have a primary key or
if upsert mode is in effect (UPDATE_ON_EXISTING_PK
is TRUE
), then this option has no effect.
Supported values:
TRUE
: Ignore source
table records whose primary key values
collide with those of target table
records
FALSE
: Raise an
error for any source table record whose
primary key values collide with those of
a target table record
FALSE
.
TRUNCATE_STRINGS
: If set to TRUE
, it allows inserting longer strings into
smaller charN string columns by truncating the
longer strings to fit.
Supported values:
The default value is FALSE
.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getTableName()
tableName
.public AppendRecordsRequest setTableName(String tableName)
tableName
- The new value for tableName
.this
to mimic the builder pattern.public String getSourceTableName()
sourceTableName
.public AppendRecordsRequest setSourceTableName(String sourceTableName)
sourceTableName
- The new value for sourceTableName
.this
to mimic the builder pattern.public Map<String,String> getFieldMap()
tableName
) as the keys, and corresponding column
names or expressions (e.g., 'col_name+1') from the source table
(specified by sourceTableName
). Must be
existing column names in source table and target table, and their types
must be matched. For details on using expressions, see Expressions.fieldMap
.public AppendRecordsRequest setFieldMap(Map<String,String> fieldMap)
tableName
) as the keys, and corresponding column
names or expressions (e.g., 'col_name+1') from the source table
(specified by sourceTableName
). Must be
existing column names in source table and target table, and their types
must be matched. For details on using expressions, see Expressions.fieldMap
- The new value for fieldMap
.this
to mimic the builder pattern.public Map<String,String> getOptions()
OFFSET
: A positive integer indicating the
number of initial results to skip from sourceTableName
. Default is 0. The
minimum allowed value is 0. The maximum allowed value is
MAX_INT. The default value is '0'.
LIMIT
: A positive integer indicating the
maximum number of results to be returned from sourceTableName
. Or END_OF_SET (-9999) to
indicate that the max number of results should be returned. The
default value is '-9999'.
EXPRESSION
: Optional filter
expression to apply to the sourceTableName
. The default value is ''.
ORDER_BY
: Comma-separated list of the
columns to be sorted by from source table (specified by sourceTableName
), e.g., 'timestamp asc, x
desc'. The ORDER_BY
columns do not have
to be present in fieldMap
. The default
value is ''.
UPDATE_ON_EXISTING_PK
:
Specifies the record collision policy for inserting source table
records (specified by sourceTableName
) into a target table (specified by tableName
) with a primary key. If set to TRUE
, any existing table record with primary key values that
match those of a source table record being inserted will be
replaced by that new record (the new data will be "upserted").
If set to FALSE
, any existing table record
with primary key values that match those of a source table
record being inserted will remain unchanged, while the source
record will be rejected and an error handled as determined by
IGNORE_EXISTING_PK
. If the
specified table does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Upsert new records when
primary keys match existing records
FALSE
: Reject new records when
primary keys match existing records
FALSE
.
IGNORE_EXISTING_PK
: Specifies
the record collision error-suppression policy for inserting
source table records (specified by sourceTableName
) into a target table (specified by tableName
) with a primary key, only used when not in upsert mode
(upsert mode is disabled when UPDATE_ON_EXISTING_PK
is FALSE
). If set to TRUE
, any
source table record being inserted that is rejected for having
primary key values that match those of an existing target table
record will be ignored with no error generated. If FALSE
, the rejection of any source table record
for having primary key values matching an existing target table
record will result in an error being raised. If the specified
table does not have a primary key or if upsert mode is in effect
(UPDATE_ON_EXISTING_PK
is
TRUE
), then this option has no effect.
Supported values:
TRUE
: Ignore source table records
whose primary key values collide with those of target
table records
FALSE
: Raise an error for any
source table record whose primary key values collide
with those of a target table record
FALSE
.
TRUNCATE_STRINGS
: If set to
TRUE
, it allows inserting longer strings
into smaller charN string columns by truncating the longer
strings to fit.
Supported values:
The default value is FALSE
.
Map
.options
.public AppendRecordsRequest setOptions(Map<String,String> options)
OFFSET
: A positive integer indicating the
number of initial results to skip from sourceTableName
. Default is 0. The
minimum allowed value is 0. The maximum allowed value is
MAX_INT. The default value is '0'.
LIMIT
: A positive integer indicating the
maximum number of results to be returned from sourceTableName
. Or END_OF_SET (-9999) to
indicate that the max number of results should be returned. The
default value is '-9999'.
EXPRESSION
: Optional filter
expression to apply to the sourceTableName
. The default value is ''.
ORDER_BY
: Comma-separated list of the
columns to be sorted by from source table (specified by sourceTableName
), e.g., 'timestamp asc, x
desc'. The ORDER_BY
columns do not have
to be present in fieldMap
. The default
value is ''.
UPDATE_ON_EXISTING_PK
:
Specifies the record collision policy for inserting source table
records (specified by sourceTableName
) into a target table (specified by tableName
) with a primary key. If set to TRUE
, any existing table record with primary key values that
match those of a source table record being inserted will be
replaced by that new record (the new data will be "upserted").
If set to FALSE
, any existing table record
with primary key values that match those of a source table
record being inserted will remain unchanged, while the source
record will be rejected and an error handled as determined by
IGNORE_EXISTING_PK
. If the
specified table does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Upsert new records when
primary keys match existing records
FALSE
: Reject new records when
primary keys match existing records
FALSE
.
IGNORE_EXISTING_PK
: Specifies
the record collision error-suppression policy for inserting
source table records (specified by sourceTableName
) into a target table (specified by tableName
) with a primary key, only used when not in upsert mode
(upsert mode is disabled when UPDATE_ON_EXISTING_PK
is FALSE
). If set to TRUE
, any
source table record being inserted that is rejected for having
primary key values that match those of an existing target table
record will be ignored with no error generated. If FALSE
, the rejection of any source table record
for having primary key values matching an existing target table
record will result in an error being raised. If the specified
table does not have a primary key or if upsert mode is in effect
(UPDATE_ON_EXISTING_PK
is
TRUE
), then this option has no effect.
Supported values:
TRUE
: Ignore source table records
whose primary key values collide with those of target
table records
FALSE
: Raise an error for any
source table record whose primary key values collide
with those of a target table record
FALSE
.
TRUNCATE_STRINGS
: If set to
TRUE
, it allows inserting longer strings
into smaller charN string columns by truncating the longer
strings to fit.
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.