Package com.snowflake.snowpark_java
Class MatchedClauseBuilder
- java.lang.Object
-
- com.snowflake.snowpark_java.MatchedClauseBuilder
-
public class MatchedClauseBuilder extends Object
Builder for a matched clause. It provides APIs to build update and delete actions- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 withassignments
, 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 withassignments
, where the key specifies column name and value specifies its assigned value.
-
-
-
Method Detail
-
update
public 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 withassignments
, where the key specifies column name and value specifies its assigned value. Returns an updatedMergeBuilder
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();
- Parameters:
assignments
- A map contains the column being updated and the new value.- Returns:
MergeBuilder
- Since:
- 1.1.0
-
updateColumn
public 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 withassignments
, where the key specifies column name and value specifies its assigned value. Returns an updatedMergeBuilder
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();
- Parameters:
assignments
- A map contains the column being updated and the new value.- Returns:
MergeBuilder
- Since:
- 1.1.0
-
delete
public MergeBuilder delete()
Defines a delete action for the matched clause, when a row in target is matched, delete it from target. Returns an updatedMergeBuilder
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();
- Returns:
MergeBuilder
- Since:
- 1.1.0
-
-