You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2022/11/01 16:24:00 UTC
[jira] [Assigned] (SPARK-40921) Add WHEN NOT MATCHED BY SOURCE clause to MERGE INTO command
[ https://issues.apache.org/jira/browse/SPARK-40921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wenchen Fan reassigned SPARK-40921:
-----------------------------------
Assignee: Johan Lasperas
> Add WHEN NOT MATCHED BY SOURCE clause to MERGE INTO command
> -----------------------------------------------------------
>
> Key: SPARK-40921
> URL: https://issues.apache.org/jira/browse/SPARK-40921
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 3.4.0
> Reporter: Johan Lasperas
> Assignee: Johan Lasperas
> Priority: Major
> Fix For: 3.4.0
>
>
> The MERGE INTO syntax in Spark allows two types of WHEN clause:
> * WHEN MATCHED: Specify optional condition and actions (delete or update) to apply to rows that satisfy the merge condition.
> * WHEN NOT MATCHED: Specify optional condition and actions (insert) to apply toi rows from the source table that don't satisfy the match condition.
> Other products also offer a third type of WHEN clause:
> * WHEN NOT MATCHED BY SOURCE: Specify optional condition and actions (delete or update) to apply to rows from the target table that don't satisfy the merge condition.
> See for example [T-SQL Merge Documentation|https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-ver16]
> Example:
> {code:java}
> MERGE INTO target
> USING source
> ON target.key = source.key
> WHEN MATCHED THEN UPDATE SET *
> WHEN NOT MATCHED THEN INSERT *
> WHEN NOT MATCHED BY SOURCE THEN DELETE {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org