Snowpark Scala API Reference1.19.1 < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package com
  Definition Classes
    root
-  package snowflake
  Definition Classes
    com
-  package snowpark
  Definition Classes
    snowflake
-  package types

  This package contains all Snowpark logical types.

  This package contains all Snowpark logical types.

  Definition Classes
    snowpark
  Since

    0.1.0

-  package udaf
  Definition Classes
    snowpark
-  package udtf
  Definition Classes
    snowpark
- AggregateFunction
- AsyncJob
- CaseExpr
- Column
- CopyableDataFrame
- CopyableDataFrameAsyncActor
- DataFrame
- DataFrameAsyncActor
- DataFrameNaFunctions
- DataFrameReader
- DataFrameStatFunctions
- DataFrameWriter
- DataFrameWriterAsyncActor
- DeleteResult
- FileOperation
- GetResult
- GroupingSets
- HasCachedResult
- MatchedClauseBuilder
- MergeBuilder
- MergeBuilderAsyncActor
- MergeResult
- MergeTypedAsyncJob
- NotMatchedClauseBuilder
- PublicPreview
- PutResult
- RelationalGroupedDataFrame
- Row
- SProcRegistration
- SaveMode
- Session
- SnowparkClientException
- StoredProcedure
- TableFunction
- TypedAsyncJob
- UDAFRegistration
- UDFRegistration
- UDTFRegistration
- Updatable
- UpdatableAsyncActor
- UpdateResult
- UserDefinedFunction
- Window
- WindowSpec
- WriteFileResult
- functions
- tableFunctions

c

com.snowflake.snowpark

# MergeBuilder 

###

#### class MergeBuilder extends AnyRef

Builder for a merge action. It provides APIs to build matched and not matched clauses.

Since

  0.7.0

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. MergeBuilder
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  def action[T](funcName: String)(func: ⇒ T): T
   Attributes
     protected
   Annotations
     @inline()
5.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
6.  def async: MergeBuilderAsyncActor

   Returns a MergeBuilderAsyncActor object that can be used to execute MergeBuilder actions asynchronously.

   Returns a MergeBuilderAsyncActor object that can be used to execute MergeBuilder actions asynchronously.

   Example:

       val target = session.table(tableName)
       val source = Seq((10, "new")).toDF("id", "desc")
       val asyncJob = target
         .merge(source, target("id") === source("id"))
         .whenMatched
         .update(Map(target("desc") -> source("desc")))
         .async
         .collect()
       // At this point, the thread is not blocked. You can perform additional work before
       // calling asyncJob.getResult() to retrieve the results of the action.
       // NOTE: getResult() is a blocking call.
       val mergeResult = asyncJob.getResult()

   returns

     A MergeBuilderAsyncActor object

   Since

     1.3.0

7.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... ) @native() @HotSpotIntrinsicCandidate()
8.  def collect(): MergeResult

   Executes the merge action and returns a MergeResult, representing number of rows inserted, updated and deleted by this merge action.

   Executes the merge action and returns a MergeResult, representing number of rows inserted, updated and deleted by this merge action.

   returns

     MergeResult

   Since

     0.7.0

9.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
10.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
11.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native() @HotSpotIntrinsicCandidate()
12.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native() @HotSpotIntrinsicCandidate()
13.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
14.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
15.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @HotSpotIntrinsicCandidate()
16.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @HotSpotIntrinsicCandidate()
17.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
18.  def toString(): String
    Definition Classes
      AnyRef → Any
19.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
20.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... ) @native()
21.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
22.  def whenMatched(condition: Column): MatchedClauseBuilder

    Adds a matched clause into the merge action.

    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.

    For example:

        target.merge(source, target("id") === source("id")).whenMatched(target("value") === lit(0))

    Adds a matched clause where a row in the Updatable target is matched if its id equals the id of a row in the DataFrame source and its value equals 0.

    returns

      MatchedClauseBuilder

    Since

      0.7.0

23.  def whenMatched: MatchedClauseBuilder

    Adds a matched clause into the merge action.

    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.

    For example:

        target.merge(source, target("id") === source("id")).whenMatched

    Adds a matched clause where a row in the Updatable target is matched if its id equals the id of a row in the DataFrame source.

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

    returns

      MatchedClauseBuilder

    Since

      0.7.0

24.  def whenNotMatched(condition: Column): NotMatchedClauseBuilder

    Adds a not matched clause into the merge action.

    Adds a not matched clause into the merge action. It matches all rows in source that do not satisfy <joinExpr> but satisfy <condition>. Returns a MatchedClauseBuilder which provides APIs to define actions to take when a row is matched.

    For example:

        target.merge(source, target("id") === source("id"))
        .whenNotMatched(source("value") === lit(0))

    Adds a not matched clause where a row in the DataFrame source is not matched if its id does not equal the id of any row in the Updatable source and its value equals 0.

    returns

      NotMatchedClauseBuilder

    Since

      0.7.0

25.  def whenNotMatched: NotMatchedClauseBuilder

    Adds a not matched clause into the merge action.

    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.

    For example:

        target.merge(source, target("id") === source("id")).whenNotMatched

    Adds a not matched clause where a row in the DataFrame source is not matched if its id does not equal the id of any row in the Updatable target.

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

    returns

      NotMatchedClauseBuilder

    Since

      0.7.0

### Deprecated Value Members

1.  def finalize(): Unit
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( classOf[java.lang.Throwable] ) @Deprecated
   Deprecated

### Inherited from AnyRef

### Inherited from Any

### action

### Transformations

### Ungrouped