class MergeBuilder extends AnyRef
Builder for a merge action. It provides APIs to build matched and not matched clauses.
- Since
0.7.0
- Alphabetic
- By Inheritance
- MergeBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def action[T](funcName: String)(func: => T): T
- Attributes
- protected
- Annotations
- @inline()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- 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
- Since
0.7.0
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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
- Since
0.7.0
- 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
- Since
0.7.0
- 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
- Since
0.7.0
- 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
- Since
0.7.0
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)