You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xianyin Xin (Jira)" <ji...@apache.org> on 2020/06/19 07:01:00 UTC
[jira] [Created] (SPARK-32030) Support unlimited MATCHED and NOT
MATCHED clauses in MERGE INTO
Xianyin Xin created SPARK-32030:
-----------------------------------
Summary: Support unlimited MATCHED and NOT MATCHED clauses in MERGE INTO
Key: SPARK-32030
URL: https://issues.apache.org/jira/browse/SPARK-32030
Project: Spark
Issue Type: Improvement
Components: SQL
Affects Versions: 3.0.1
Reporter: Xianyin Xin
Now the MERGE INTO syntax is,
```
MERGE INTO [db_name.]target_table [AS target_alias]
USING [db_name.]source_table [<time_travel_version>] [AS source_alias]
ON <merge_condition>
[ WHEN MATCHED [ AND <condition> ] THEN <matched_action> ]
[ WHEN MATCHED [ AND <condition> ] THEN <matched_action> ]
[ WHEN NOT MATCHED [ AND <condition> ] THEN <not_matched_action> ]
```
It would be nice if we support unlimited MATCHED and NOT MATCHED clauses in MERGE INTO statement, because users may want to deal with different "AND <condition>"s, the result of which just like a series of "CASE WHEN"s. The expected syntax looks like
```
MERGE INTO [db_name.]target_table [AS target_alias]
USING [db_name.]source_table [<time_travel_version>] [AS source_alias]
ON <merge_condition>
[when_clause [, ...]]
```
where `when_clause` is
```
WHEN MATCHED [ AND <condition> ] THEN <matched_action>
```
or
```
WHEN NOT MATCHED [ AND <condition> ] THEN <not_matched_action>
```
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org