public class NotMatchedClauseBuilder extends Object
| Modifier and Type | Method and Description |
|---|---|
MergeBuilder |
insert(Column[] values)
Defines an insert action for the not matched clause, when a row in source is not matched,
insert a row in target with 'values'.
|
MergeBuilder |
insert(Map<Column,Column> assignments)
Defines an insert action for the not matched clause, when a row in source is not matched,
insert a row in target with 'assignments', where the key specifies column name and value
specifies its assigned value.
|
MergeBuilder |
insertRow(Map<String,Column> assignments)
Defines an insert action for the not matched clause, when a row in source is not matched,
insert a row in target with 'assignments', where the key specifies column name and value
specifies its assigned value.
|
public MergeBuilder insert(Column[] values)
MergeBuilder with the new
clause added.
For example:
session.table("tableName").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenNotMatched().insert(new Column[]{df.col("col_b"), Functions.lit("c"), Functions.lit(true)})
.collect();
Note: This API inserts into all columns in target with values, so the length of 'values' must
equal the number of columns in target.values - The valued being insertedMergeBuilderpublic MergeBuilder insert(Map<Column,Column> assignments)
MergeBuilder with the new clause added.
Map<Column, Column> assignments = new HashMap<>();
assignments.put(Functions.col("col_1"), df.col("col_b"));
session.table("tableName").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenNotMatched(df.col("col_a").equal_to(Functions.lit(3)))
.insert(assignments).collect();
assignments - A map contains row data.MergeBuilderpublic MergeBuilder insertRow(Map<String,Column> assignments)
MergeBuilder with the new clause added.
For example:
Map<String, Column> assignments = new HashMap<>();
assignments.put("col_1", df.col("col_b"));
session.table("tableName").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenNotMatched(df.col("col_a").equal_to(Functions.lit(3)))
.insertRow(assignments).collect();
assignments - A map contains row data.MergeBuilder© 2022 Snowflake Inc. All Rights Reserved