問題文
A nightly job must apply a set of changes to a target table: update the rows that match on a key and insert the rows that do not. Which approach does this in one operation with the DataFrame API?
選択肢
- Call merge on the target table with the source DataFrame, the join expression, and a list of matched and not-matched clauses.
- Union the source into the target and rely on the table to keep the newer row for each key.
- Call update on the target with the source, then call an insert method for the rows that the update did not touch, in that fixed order.
- Save the source over the target with the overwrite mode, because that keeps matching rows and adds the rest.