drop table if exists hudi_gh_ext_fixed;
create table hudi_gh_ext_fixed (id int, name string, price double, ts long) using hudi options(primaryKey = 'id', precombineField = 'ts') location 'file:///tmp/hudi-h4-fixed';
insert into hudi_gh_ext_fixed values(3, 'AMZN', 300, 120);
insert into hudi_gh_ext_fixed values(2, 'UBER', 300, 120);
insert into hudi_gh_ext_fixed values(4, 'GOOG', 300, 120);
update hudi_gh_ext_fixed set price = 150.0 where name = 'UBER';
drop table if exists hudi_fixed;
create table hudi_fixed (id int, name string, price double, ts long) using hudi options(primaryKey = 'id', precombineField = 'ts') partitioned by (ts) location 'file:///tmp/hudi-h4-part-fixed';
insert into hudi_fixed values(2, 'UBER', 200, 120);
MERGE INTO hudi_fixed
USING (select id, name, price, ts from hudi_gh_ext_fixed) updates
ON hudi_fixed.name = updates.name
WHEN MATCHED THEN
UPDATE SET *
WHEN NOT MATCHED
THEN INSERT *;