io.milvus.param.dml

## Class UpsertParam.Builder

- java.lang.Object
- - io.milvus.param.dml.InsertParam.Builder
  - - io.milvus.param.dml.UpsertParam.Builder

Enclosing class:
  UpsertParam

    public static class UpsertParam.Builder
    extends InsertParam.Builder

Builder for `UpsertParam` class.

### Method Summary

All Methods Instance Methods Concrete Methods
`UpsertParam` `build()` Verifies parameters and creates a new `UpsertParam` instance.
`UpsertParam.Builder` `withCollectionName(@NonNull java.lang.String collectionName)` Sets the collection name.
`UpsertParam.Builder` `withDatabaseName(java.lang.String databaseName)` Sets the database name.
`UpsertParam.Builder` `withFields(@NonNull java.util.List<InsertParam.Field> fields)` Sets the column data to insert.
`UpsertParam.Builder` `withPartitionName(@NonNull java.lang.String partitionName)` Set partition name (Optional).
`UpsertParam.Builder` `withRows(@NonNull java.util.List<com.google.gson.JsonObject> rows)` Sets the row data to insert.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### withDatabaseName

    public UpsertParam.Builder withDatabaseName(java.lang.String databaseName)

Sets the database name. database name can be nil.

Overrides:
  `withDatabaseName` in class `InsertParam.Builder`
Parameters:
  `databaseName` - database name
Returns:
  `Builder`

#### withCollectionName

    public UpsertParam.Builder withCollectionName(@NonNull
                                                  @NonNull java.lang.String collectionName)

Sets the collection name. Collection name cannot be empty or null.

Overrides:
  `withCollectionName` in class `InsertParam.Builder`
Parameters:
  `collectionName` - collection name
Returns:
  `Builder`

#### withPartitionName

    public UpsertParam.Builder withPartitionName(@NonNull
                                                 @NonNull java.lang.String partitionName)

Set partition name (Optional). This partition name will be ignored if the collection has a partition key field.

Overrides:
  `withPartitionName` in class `InsertParam.Builder`
Parameters:
  `partitionName` - partition name
Returns:
  `Builder`

#### withFields

    public UpsertParam.Builder withFields(@NonNull
                                          @NonNull java.util.List<InsertParam.Field> fields)

Sets the column data to insert. The field list cannot be empty.

Overrides:
  `withFields` in class `InsertParam.Builder`
Parameters:
  `fields` - insert column data
Returns:
  `Builder`
See Also:
  `InsertParam.Field`

#### withRows

    public UpsertParam.Builder withRows(@NonNull
                                        @NonNull java.util.List<com.google.gson.JsonObject> rows)

Sets the row data to insert. The rows list cannot be empty. Internal class for insert data. If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input; If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input; If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input; If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input; If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input; If dataType is JSON, use JsonObject.add(key, JsonElement) to input; Note: 1. For scalar numeric values, value will be cut according to the type of the field. For example: An Int8 field named "XX", you set the value to be 128 by JsonObject.add("XX", 128), the value 128 is cut to -128. An Int64 field named "XX", you set the value to be 3.9 by JsonObject.add("XX", 3.9), the value 3.9 is cut to 3. 2. String value can be parsed to numeric/boolean type if the value is valid. For example: A Bool field named "XX", you set the value to be "TRUE" by JsonObject.add("XX", "TRUE"), the string "TRUE" is parsed as true. A Float field named "XX", you set the value to be "3.5" by JsonObject.add("XX", "3.5", the string "3.5" is parsed as 3.5.

Overrides:
  `withRows` in class `InsertParam.Builder`
Parameters:
  `rows` - insert row data
Returns:
  `Builder`
See Also:
  `JsonObject`

#### build

    public UpsertParam build()
                      throws ParamException

Verifies parameters and creates a new `UpsertParam` instance.

Overrides:
  `build` in class `InsertParam.Builder`
Returns:
  `UpsertParam`
Throws:
  `ParamException`