public class MergeInsertParams extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MergeInsertParams.WhenMatched |
static class |
MergeInsertParams.WhenNotMatched |
static class |
MergeInsertParams.WhenNotMatchedBySource |
| Constructor and Description |
|---|
MergeInsertParams(List<String> on) |
| Modifier and Type | Method and Description |
|---|---|
int |
conflictRetries() |
List<String> |
on() |
long |
retryTimeoutMs() |
boolean |
skipAutoCleanup() |
String |
toString() |
MergeInsertParams.WhenMatched |
whenMatched() |
Optional<String> |
whenMatchedUpdateExpr() |
String |
whenMatchedValue() |
MergeInsertParams.WhenNotMatched |
whenNotMatched() |
MergeInsertParams.WhenNotMatchedBySource |
whenNotMatchedBySource() |
Optional<String> |
whenNotMatchedBySourceDeleteExpr() |
Optional<ByteBuffer> |
whenNotMatchedBySourceDeleteSubstraitExpr() |
String |
whenNotMatchedBySourceValue() |
String |
whenNotMatchedValue() |
MergeInsertParams |
withConflictRetries(int retries)
Set number of times to retry the operation if there is contention.
|
MergeInsertParams |
withMatchedDoNothing()
Specify that when a row in the source table matches a row in the target table, the row in the
target table is kept unchanged.
|
MergeInsertParams |
withMatchedFail()
Specify that when a row in the source table matches a row in the target table, the entire merge
operation will fail with an error.
|
MergeInsertParams |
withMatchedUpdateAll()
Specify that when a row in the source table matches a row in the target table, the row is
deleted from the target table and the matched row based on the source table is inserted.
|
MergeInsertParams |
withMatchedUpdateIf(String expr)
Specify that when a row in the source table matches a row in the target table and the
expression evaluates to true, the row in the target table is updated by the matched row from
the source table.
|
MergeInsertParams |
withNotMatched(MergeInsertParams.WhenNotMatched whenNotMatched)
Specify what should happen when a source row has no match in the target.
|
MergeInsertParams |
withNotMatchedBySourceDelete()
Specify that when a target row has no match in the source, the row is deleted from the target
table.
|
MergeInsertParams |
withNotMatchedBySourceDeleteIf(String expr)
Specify that when a target row has no match in the source and the expression evaluates to true,
the row is deleted from the target table.
|
MergeInsertParams |
withNotMatchedBySourceDeleteSubstraitIf(ByteBuffer expr)
Specify that when a target row has no match in the source and the expression evaluates to true,
the row is deleted from the target table.
|
MergeInsertParams |
withNotMatchedBySourceKeep()
Specify that when a target row has no match in the source, the row is kept in the target table.
|
MergeInsertParams |
withRetryTimeoutMs(long timeoutMs)
Set the timeout in milliseconds used to limit retries.
|
MergeInsertParams |
withSkipAutoCleanup(boolean skipAutoCleanup)
If true, skip auto cleanup during commits.
|
public MergeInsertParams withMatchedUpdateAll()
This can be used to achieve upsert behavior.
public MergeInsertParams withMatchedDoNothing()
This can be used to achieve find-or-create behavior.
public MergeInsertParams withMatchedUpdateIf(String expr)
This can be used to achieve upsert behavior.
The expression can reference source tables' columns with source. and target
tables' columns with target. This is an example:
source.column1 = target.column1 AND source.column2 = target.column2
expr - The expression to evaluate on the rows in the source table and target table.public MergeInsertParams withMatchedFail()
This can be used to ensure that no existing rows are overwritten or modified after inserted.
public MergeInsertParams withNotMatched(MergeInsertParams.WhenNotMatched whenNotMatched)
whenNotMatched - The action to take when a source row has no match in the target.public MergeInsertParams withNotMatchedBySourceKeep()
public MergeInsertParams withNotMatchedBySourceDelete()
public MergeInsertParams withNotMatchedBySourceDeleteIf(String expr)
expr - The sql expression to evaluate on the rows in the target table.public MergeInsertParams withNotMatchedBySourceDeleteSubstraitIf(ByteBuffer expr)
expr - The substrait expression to evaluate on the rows in the target table.public MergeInsertParams withConflictRetries(int retries)
If this is set greater than 0, then the operation will keep a copy of the input data either in memory or on disk (depending on the size of the data) and will retry the operation if there is contention.
Default is 10.
retries - Number of times to retry the operation if there is contention.public MergeInsertParams withRetryTimeoutMs(long timeoutMs)
This is the maximum time to spend on the operation before giving up. At least one attempt will be made, regardless of how long it takes to complete. Subsequent attempts will be cancelled once this timeout is reached. If the timeout has been reached during the first attempt, the operation will be cancelled immediately.
Default is 30000.
timeoutMs - Timeout in milliseconds used to limit retries.public MergeInsertParams withSkipAutoCleanup(boolean skipAutoCleanup)
skipAutoCleanup - Whether to skip auto cleanup during commits.public MergeInsertParams.WhenMatched whenMatched()
public String whenMatchedValue()
public MergeInsertParams.WhenNotMatched whenNotMatched()
public String whenNotMatchedValue()
public MergeInsertParams.WhenNotMatchedBySource whenNotMatchedBySource()
public String whenNotMatchedBySourceValue()
public Optional<ByteBuffer> whenNotMatchedBySourceDeleteSubstraitExpr()
public int conflictRetries()
public long retryTimeoutMs()
public boolean skipAutoCleanup()
Copyright © 2025. All rights reserved.