Class MergeBuilder


  • public class MergeBuilder
    extends Object
    Builder for a merge action. It provides APIs to build matched and not matched clauses.
    Since:
    1.1.0
    • Method Detail

      • whenMatched

        public MatchedClauseBuilder whenMatched()
        Adds a matched clause into the merge action. It matches all remaining rows in target that satisfy 'joinExpr'. Returns a MatchedClauseBuilder which provides APIs to define actions to take when a row is matched.

        Caution: Since it matches all remaining rows, no more whenMatched calls will be accepted beyond this call.

        Returns:
        MatchedClauseBuilder
        Since:
        1.1.0
      • whenMatched

        public MatchedClauseBuilder whenMatched​(Column condition)
        Adds a matched clause into the merge action. It matches all rows in target that satisfy 'joinExpr' while also satisfying 'condition'. Returns a MatchedClauseBuilder which provides APIs to define actions to take when a row is matched.
        Parameters:
        condition - The condition expression
        Returns:
        MatchedClauseBuilder
        Since:
        1.1.0
      • whenNotMatched

        public NotMatchedClauseBuilder whenNotMatched()
        Adds a not matched clause into the merge action. It matches all remaining rows in source that do not satisfy 'joinExpr'. Returns a MatchedClauseBuilder which provides APIs to define actions to take when a row is not matched.

        Caution: Since it matches all remaining rows, no more whenNotMatched calls will be accepted beyond this call.

        Returns:
        NotMatchedClauseBuilder
        Since:
        1.1.0
      • whenNotMatched

        public NotMatchedClauseBuilder whenNotMatched​(Column condition)
        Adds a matched clause into the merge action. It matches all rows in target that satisfy 'joinExpr' while also satisfying 'condition'. Returns a MatchedClauseBuilder which provides APIs to define actions to take when a row is matched.
        Parameters:
        condition - The condition expression
        Returns:
        MatchedClauseBuilder
        Since:
        1.1.0
      • collect

        public MergeResult collect()
        Executes the merge action and returns a MergeResult, representing number of rows inserted, updated and deleted by this merge action.
        Returns:
        MergeResult
        Since:
        1.1.0
      • async

        public MergeBuilderAsyncActor async()
        Returns a MergeBuilderAsyncActor object that can be used to execute MergeBuilder actions asynchronously.
        Returns:
        A MergeBuilderAsyncActor object
        Since:
        1.3.0