Package com.gpudb.protocol
Class AppendRecordsRequest
- java.lang.Object
-
- com.gpudb.protocol.AppendRecordsRequest
-
- All Implemented Interfaces:
org.apache.avro.generic.GenericContainer,org.apache.avro.generic.IndexedRecord
public class AppendRecordsRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters forGPUdb.appendRecords.Append (or insert) all records from a source table (specified by
sourceTableName) to a particular target table (specified bytableName). The field map (specified byfieldMap) holds the user specified map of target table column names with their mapped source column names.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAppendRecordsRequest.OptionsA set of string constants for theAppendRecordsRequestparameteroptions.
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Objectget(int index)This method supports the Avro framework and is not intended to be called directly by the user.static org.apache.avro.SchemagetClassSchema()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 bytableName) as the keys, and corresponding column names or expressions (e.g., 'col_name+1') from the source table (specified bysourceTableName).Map<String,String>getOptions()Optional parameters.org.apache.avro.SchemagetSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetSourceTableName()The source table name to get records from, in [schema_name.]table_name format, using standard name resolution rules.StringgetTableName()The table name for the records to be appended, in [schema_name.]table_name format, using standard name resolution rules.inthashCode()voidput(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.AppendRecordsRequestsetFieldMap(Map<String,String> fieldMap)Contains the mapping of column names from the target table (specified bytableName) as the keys, and corresponding column names or expressions (e.g., 'col_name+1') from the source table (specified bysourceTableName).AppendRecordsRequestsetOptions(Map<String,String> options)Optional parameters.AppendRecordsRequestsetSourceTableName(String sourceTableName)The source table name to get records from, in [schema_name.]table_name format, using standard name resolution rules.AppendRecordsRequestsetTableName(String tableName)The table name for the records to be appended, in [schema_name.]table_name format, using standard name resolution rules.StringtoString()
-
-
-
Constructor Detail
-
AppendRecordsRequest
public AppendRecordsRequest()
Constructs an AppendRecordsRequest object with default parameters.
-
AppendRecordsRequest
public AppendRecordsRequest(String tableName, String sourceTableName, Map<String,String> fieldMap, Map<String,String> options)
Constructs an AppendRecordsRequest object with the specified parameters.- Parameters:
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 bytableName) as the keys, and corresponding column names or expressions (e.g., 'col_name+1') from the source table (specified bysourceTableName). 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 fromsourceTableName. 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 fromsourceTableName. 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 thesourceTableName. The default value is ''.ORDER_BY: Comma-separated list of the columns to be sorted by from source table (specified bysourceTableName), e.g., 'timestamp asc, x desc'. TheORDER_BYcolumns do not have to be present infieldMap. The default value is ''.UPDATE_ON_EXISTING_PK: Specifies the record collision policy for inserting source table records (specified bysourceTableName) into a target table (specified bytableName) with a primary key. If set toTRUE, 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 toFALSE, 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 byIGNORE_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 recordsFALSE: 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 bysourceTableName) into a target table (specified bytableName) with a primary key, only used when not in upsert mode (upsert mode is disabled whenUPDATE_ON_EXISTING_PKisFALSE). If set toTRUE, 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. IfFALSE, 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_PKisTRUE), then this option has no effect. Supported values:TRUE: Ignore source table records whose primary key values collide with those of target table recordsFALSE: Raise an error for any source table record whose primary key values collide with those of a target table record
FALSE.PK_CONFLICT_PREDICATE_HIGHER: The record with higher value for the column resolves the primary-key insert conflict. The default value is ''.PK_CONFLICT_PREDICATE_LOWER: The record with lower value for the column resolves the primary-key insert conflict. The default value is ''.TRUNCATE_STRINGS: If set toTRUE, it allows inserting longer strings into smaller charN string columns by truncating the longer strings to fit. Supported values: The default value isFALSE.
Map.
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Returns:
- The schema for the class.
-
getTableName
public String getTableName()
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.- Returns:
- The current value of
tableName.
-
setTableName
public AppendRecordsRequest setTableName(String 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.- Parameters:
tableName- The new value fortableName.- Returns:
thisto mimic the builder pattern.
-
getSourceTableName
public String getSourceTableName()
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.- Returns:
- The current value of
sourceTableName.
-
setSourceTableName
public AppendRecordsRequest setSourceTableName(String 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.- Parameters:
sourceTableName- The new value forsourceTableName.- Returns:
thisto mimic the builder pattern.
-
getFieldMap
public Map<String,String> getFieldMap()
Contains the mapping of column names from the target table (specified bytableName) as the keys, and corresponding column names or expressions (e.g., 'col_name+1') from the source table (specified bysourceTableName). Must be existing column names in source table and target table, and their types must be matched. For details on using expressions, see Expressions.- Returns:
- The current value of
fieldMap.
-
setFieldMap
public AppendRecordsRequest setFieldMap(Map<String,String> fieldMap)
Contains the mapping of column names from the target table (specified bytableName) as the keys, and corresponding column names or expressions (e.g., 'col_name+1') from the source table (specified bysourceTableName). Must be existing column names in source table and target table, and their types must be matched. For details on using expressions, see Expressions.- Parameters:
fieldMap- The new value forfieldMap.- Returns:
thisto mimic the builder pattern.
-
getOptions
public Map<String,String> getOptions()
Optional parameters.OFFSET: A positive integer indicating the number of initial results to skip fromsourceTableName. 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 fromsourceTableName. 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 thesourceTableName. The default value is ''.ORDER_BY: Comma-separated list of the columns to be sorted by from source table (specified bysourceTableName), e.g., 'timestamp asc, x desc'. TheORDER_BYcolumns do not have to be present infieldMap. The default value is ''.UPDATE_ON_EXISTING_PK: Specifies the record collision policy for inserting source table records (specified bysourceTableName) into a target table (specified bytableName) with a primary key. If set toTRUE, 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 toFALSE, 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 byIGNORE_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 recordsFALSE: 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 bysourceTableName) into a target table (specified bytableName) with a primary key, only used when not in upsert mode (upsert mode is disabled whenUPDATE_ON_EXISTING_PKisFALSE). If set toTRUE, 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. IfFALSE, 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_PKisTRUE), then this option has no effect. Supported values:TRUE: Ignore source table records whose primary key values collide with those of target table recordsFALSE: Raise an error for any source table record whose primary key values collide with those of a target table record
FALSE.PK_CONFLICT_PREDICATE_HIGHER: The record with higher value for the column resolves the primary-key insert conflict. The default value is ''.PK_CONFLICT_PREDICATE_LOWER: The record with lower value for the column resolves the primary-key insert conflict. The default value is ''.TRUNCATE_STRINGS: If set toTRUE, it allows inserting longer strings into smaller charN string columns by truncating the longer strings to fit. Supported values: The default value isFALSE.
Map.- Returns:
- The current value of
options.
-
setOptions
public AppendRecordsRequest setOptions(Map<String,String> options)
Optional parameters.OFFSET: A positive integer indicating the number of initial results to skip fromsourceTableName. 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 fromsourceTableName. 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 thesourceTableName. The default value is ''.ORDER_BY: Comma-separated list of the columns to be sorted by from source table (specified bysourceTableName), e.g., 'timestamp asc, x desc'. TheORDER_BYcolumns do not have to be present infieldMap. The default value is ''.UPDATE_ON_EXISTING_PK: Specifies the record collision policy for inserting source table records (specified bysourceTableName) into a target table (specified bytableName) with a primary key. If set toTRUE, 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 toFALSE, 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 byIGNORE_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 recordsFALSE: 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 bysourceTableName) into a target table (specified bytableName) with a primary key, only used when not in upsert mode (upsert mode is disabled whenUPDATE_ON_EXISTING_PKisFALSE). If set toTRUE, 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. IfFALSE, 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_PKisTRUE), then this option has no effect. Supported values:TRUE: Ignore source table records whose primary key values collide with those of target table recordsFALSE: Raise an error for any source table record whose primary key values collide with those of a target table record
FALSE.PK_CONFLICT_PREDICATE_HIGHER: The record with higher value for the column resolves the primary-key insert conflict. The default value is ''.PK_CONFLICT_PREDICATE_LOWER: The record with lower value for the column resolves the primary-key insert conflict. The default value is ''.TRUNCATE_STRINGS: If set toTRUE, it allows inserting longer strings into smaller charN string columns by truncating the longer strings to fit. Supported values: The default value isFALSE.
Map.- Parameters:
options- The new value foroptions.- Returns:
thisto mimic the builder pattern.
-
getSchema
public org.apache.avro.Schema getSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getSchemain interfaceorg.apache.avro.generic.GenericContainer- Returns:
- The schema object describing this class.
-
get
public Object get(int index)
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to get- Returns:
- value of the field with the given index.
- Throws:
IndexOutOfBoundsException
-
put
public void put(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
putin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to setvalue- the value to set- Throws:
IndexOutOfBoundsException
-
-