Source column:
SOURCE_TIMESTAMP and CDC_ACTION_FLAG ('I', 'U', 'D')
order by source ID ascending and Source_Timestamp descending, add sort flag.
aggregate the default last(CDC_ACTION_FLAG) by source ID, it will get all 'I' if there is any.
Treat the 'I' as insert.
Treat the 'D' as insert new and update old.