Package com.snowflake.snowpark_java
Class NotMatchedClauseBuilder
- java.lang.Object
-
- com.snowflake.snowpark_java.NotMatchedClauseBuilder
-
public class NotMatchedClauseBuilder extends Object
Builder for a not matched clause. It provides APIs to build insert actions- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
insert
public 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'. Returns an updatedMergeBuilder
with the new clause added.For example:
Note: This API inserts into all columns in target with values, so the length of 'values' must equal the number of columns in target.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();
- Parameters:
values
- The valued being inserted- Returns:
MergeBuilder
- Since:
- 1.1.0
-
insert
public 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. All unspecified columns are set to NULL. Returns an updatedMergeBuilder
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();
- Parameters:
assignments
- A map contains row data.- Returns:
MergeBuilder
- Since:
- 1.1.0
-
insertRow
public 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. All unspecified columns are set to NULL. 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("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();
- Parameters:
assignments
- A map contains row data.- Returns:
MergeBuilder
- Since:
- 1.1.0
-
-