Class InsertAllRequest.RowToInsert
- java.lang.Object
-
- com.google.cloud.bigquery.InsertAllRequest.RowToInsert
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- InsertAllRequest
public static class InsertAllRequest.RowToInsert extends Object implements Serializable
A Google Big Query row to be inserted into a table. EachRowToInsert
has an associated id used by BigQuery to detect duplicate insertion requests on a best-effort basis.To ensure proper serialization of numeric data, it is recommended to supply values using a string-typed representation. Additionally, data for fields of
LegacySQLTypeName.BYTES
must be provided as a base64 encoded string.Example usage of creating a row to insert:
List<Long> repeatedFieldValue = Arrays.asList(1L, 2L); Map<String, Object> recordContent = new HashMap<String, Object>(); recordContent.put("subfieldName1", "value"); recordContent.put("subfieldName2", repeatedFieldValue); Map<String, Object> rowContent = new HashMap<String, Object>(); rowContent.put("booleanFieldName", true); rowContent.put("bytesFieldName", "DQ4KDQ=="); rowContent.put("recordFieldName", recordContent); rowContent.put("numericFieldName", "1298930929292.129593272"); RowToInsert row = new RowToInsert("rowId", rowContent);
- See Also:
- Data Consistency, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Map<String,Object>
getContent()
Returns the actual content of the row, as a map.String
getId()
Returns the id associated with the row.int
hashCode()
static InsertAllRequest.RowToInsert
of(String id, Map<String,?> content)
Creates a row to be inserted with associated id.static InsertAllRequest.RowToInsert
of(Map<String,?> content)
Creates a row to be inserted without associated id.String
toString()
-
-
-
Method Detail
-
getId
public String getId()
Returns the id associated with the row. Returnsnull
if not set.
-
getContent
public Map<String,Object> getContent()
Returns the actual content of the row, as a map.The returned map is always immutable. Its iteration order is unspecified.
-
of
public static InsertAllRequest.RowToInsert of(String id, Map<String,?> content)
Creates a row to be inserted with associated id.To ensure proper serialization of numeric data, supply values using a string-typed representation. Additionally, data for fields of
LegacySQLTypeName.BYTES
must be provided as a base64 encoded string.- Parameters:
id
- id of the row, used to identify duplicatescontent
- the actual content of the row
-
of
public static InsertAllRequest.RowToInsert of(Map<String,?> content)
Creates a row to be inserted without associated id.To ensure proper serialization of numeric data, supply values using a string-typed representation. Additionally, data for fields of type
LegacySQLTypeName.BYTES
must be provided as a base64 encoded string.- Parameters:
content
- the actual content of the row
-
-