Data Preparation for ML and AI

An AWS Glue Spark job receives a daily batch of new and changed customer records and must merge it into an Apache Iceberg table in Amazon S3 so that each customer ID keeps exactly one current row. Which operation should the job use?

Show the answer

Correct answerB. MERGE INTO the table on customer ID

AWhy not this: Appending adds changed customers as second rows, so IDs are duplicated.

BWhy this is right: A merge on customer ID updates existing rows and inserts new ones, leaving one current row per customer.

CWhy not this: Overwriting replaces the whole table, losing every customer who is not in the day's batch.

DWhy not this: An inner join drops new customers and unchanged customers, and it does not write the result back as an update.

MERGE INTO matches incoming rows to existing ones on customer ID, updating matches and inserting new customers in one transaction on the Iceberg table. Appending creates duplicate IDs, overwriting drops customers missing from the batch, and an inner join keeps only customers present in both.