rdblue commented on a change in pull request #2897:
URL: https://github.com/apache/iceberg/pull/2897#discussion_r685340008



##########
File path: site/docs/spark-writes.md
##########
@@ -89,6 +90,16 @@ Inserts also support additional conditions:
 WHEN NOT MATCHED AND s.event_time > still_valid_threshold THEN INSERT (id, 
count) VALUES (s.id, 1)
 ```
 
+Source rows can also come from the target table or a subset of it.
+
+```sql
+MERGE INTO prod.db.target t
+USING (SELECT * from prod.db.target where op = 'increment') s
+ON t.id = s.id
+WHEN MATCHED AND t.count <> 0 THEN UPDATE SET t.count = 0, t.op = 'delete'
+WHEN MATCHED AND t.count = 0 THEN UPDATE SET t.count = s.count + 1
+```
+

Review comment:
       This change looks unrelated and is probably not a good example of how 
you would merge a table into itself because the `op` field would probably not 
be stored in the target. I think it's a good idea to show that you can merge a 
table into itself, but that's probably a different PR where we can discuss what 
we want in the example. I would definitely include a recommendation to add 
partition filters.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to