Class MergeIntoWriter<T>
MergeIntoWriter provides methods to define and execute merge actions based on specified
 conditions.
 Please note that schema evolution is disabled by default.
- Since:
 - 4.0.0
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionabstract voidmerge()Executes the merge operation.Initialize aWhenMatchedaction without any condition.whenMatched(Column condition) Initialize aWhenMatchedaction with a condition.Initialize aWhenNotMatchedaction without any condition.whenNotMatched(Column condition) Initialize aWhenNotMatchedaction with a condition.Initialize aWhenNotMatchedBySourceaction without any condition.whenNotMatchedBySource(Column condition) Initialize aWhenNotMatchedBySourceaction with a condition.Enable automatic schema evolution for this merge operation. 
- 
Constructor Details
- 
MergeIntoWriter
public MergeIntoWriter() 
 - 
 - 
Method Details
- 
merge
public abstract void merge()Executes the merge operation. - 
whenMatched
Initialize aWhenMatchedaction without any condition.This
WhenMatchedaction will be executed when a source row matches a target table row based on the merge condition.This
WhenMatchedcan be followed by one of the following merge actions: -updateAll: Update all the matched target table rows with source dataset rows. -update(Map): Update all the matched target table rows while changing only a subset of columns based on the provided assignment. -delete: Delete all target rows that have a match in the source table.- Returns:
 - a new 
WhenMatchedobject. 
 - 
whenMatched
Initialize aWhenMatchedaction with a condition.This
WhenMatchedaction will be executed when a source row matches a target table row based on the merge condition and the specifiedconditionis satisfied.This
WhenMatchedcan be followed by one of the following merge actions: -updateAll: Update all the matched target table rows with source dataset rows. -update(Map): Update all the matched target table rows while changing only a subset of columns based on the provided assignment. -delete: Delete all target rows that have a match in the source table.- Parameters:
 condition- aColumnrepresenting the condition to be evaluated for the action.- Returns:
 - a new 
WhenMatchedobject configured with the specified condition. 
 - 
whenNotMatched
Initialize aWhenNotMatchedaction without any condition.This
WhenNotMatchedaction will be executed when a source row does not match any target row based on the merge condition.This
WhenNotMatchedcan be followed by one of the following merge actions: -insertAll: Insert all rows from the source that are not already in the target table. -insert(Map): Insert all rows from the source that are not already in the target table, with the specified columns based on the provided assignment.- Returns:
 - a new 
WhenNotMatchedobject. 
 - 
whenNotMatched
Initialize aWhenNotMatchedaction with a condition.This
WhenNotMatchedaction will be executed when a source row does not match any target row based on the merge condition and the specifiedconditionis satisfied.This
WhenNotMatchedcan be followed by one of the following merge actions: -insertAll: Insert all rows from the source that are not already in the target table. -insert(Map): Insert all rows from the source that are not already in the target table, with the specified columns based on the provided assignment.- Parameters:
 condition- aColumnrepresenting the condition to be evaluated for the action.- Returns:
 - a new 
WhenNotMatchedobject configured with the specified condition. 
 - 
whenNotMatchedBySource
Initialize aWhenNotMatchedBySourceaction without any condition.This
WhenNotMatchedBySourceaction will be executed when a target row does not match any rows in the source table based on the merge condition.This
WhenNotMatchedBySourcecan be followed by one of the following merge actions: -updateAll: Update all the not matched target table rows with source dataset rows. -update(Map): Update all the not matched target table rows while changing only the specified columns based on the provided assignment. -delete: Delete all target rows that have no matches in the source table.- Returns:
 - a new 
WhenNotMatchedBySourceobject. 
 - 
whenNotMatchedBySource
Initialize aWhenNotMatchedBySourceaction with a condition.This
WhenNotMatchedBySourceaction will be executed when a target row does not match any rows in the source table based on the merge condition and the specifiedconditionis satisfied.This
WhenNotMatchedBySourcecan be followed by one of the following merge actions: -updateAll: Update all the not matched target table rows with source dataset rows. -update(Map): Update all the not matched target table rows while changing only the specified columns based on the provided assignment. -delete: Delete all target rows that have no matches in the source table.- Parameters:
 condition- aColumnrepresenting the condition to be evaluated for the action.- Returns:
 - a new 
WhenNotMatchedBySourceobject configured with the specified condition. 
 - 
withSchemaEvolution
Enable automatic schema evolution for this merge operation.- Returns:
 - A 
MergeIntoWriterinstance with schema evolution enabled. 
 
 -