public class MatchedClauseBuilder extends Object
| Modifier and Type | Method and Description |
|---|---|
MergeBuilder |
delete()
Defines a delete action for the matched clause, when a row in target is matched, delete it from
target.
|
MergeBuilder |
update(Map<Column,Column> assignments)
Defines an update action for the matched clause, when a row in target is matched, update the
row in target with
assignments, where the key specifies column name and value specifies
its assigned value. |
MergeBuilder |
updateColumn(Map<String,Column> assignments)
Defines an update action for the matched clause, when a row in target is matched, update the
row in target with
assignments, where the key specifies column name and value specifies
its assigned value. |
public MergeBuilder update(Map<Column,Column> assignments)
assignments, where the key specifies column name and value specifies
its assigned value. Returns an updated MergeBuilder with the new clause added.
For example:
Map<Column, Column> assignments = new HashMap<>();
assignments.put(Functions.col("col_1"), df.col("col_b"));
session.table("table").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenMatched().update(assignments).collect();
assignments - A map contains the column being updated and the new value.MergeBuilderpublic MergeBuilder updateColumn(Map<String,Column> assignments)
assignments, where the key specifies column name and value specifies
its assigned value. Returns an updated MergeBuilder with the new clause added.
For example:
Map<String, Column> assignments = new HashMap<>();
assignments.put("col_1", df.col("col_b"));
session.table("table").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenMatched(Functions.col("col_2").equal_to(Functions.lit(true)))
.update(assignments).collect();
assignments - A map contains the column being updated and the new value.MergeBuilderpublic MergeBuilder delete()
MergeBuilder with the new clause added.
For example:
session.table("table").merge(df, Functions.col("col_1").equal_to(df.col("col_a")))
.whenMatched(Functions.col("col_2").equal_to(Functions.lit(true)))
.delete().collect();
MergeBuilder© 2023 Snowflake Inc. All Rights Reserved