flyxu1991 opened a new issue #3826:
URL: https://github.com/apache/iceberg/issues/3826


   Refer to iceberg website, use SparkSql-client test merge into iceberg, there 
is an err in query: UPDATE and DELETE can appear at most once in MATCHED 
clauses in a MERGE statement.
   Here is my code:
   `create table merge_into_test_a (
       name string,
       score int,
       ts string,
       is_valid int,
       valid_time string
   ) using iceberg
   TBLPROPERTIES (
       'format-version' = '1',
       'write.parallelism' = '1'
   );
   
   create table merge_into_test_b (
       name string,
       score int,
       ts string,
       is_valid int,
       valid_time string
   ) using iceberg
   TBLPROPERTIES (
       'format-version' = '1',
       'write.parallelism' = '1'
   );
   
   merge into merge_into_test_a a
   using (
       select name, score, ts, is_valid, valid_time
       from (
           select name, score, ts, is_valid, valid_time,
               ROW_NUMBER() OVER(partition by name order by ts desc) AS rk
           from merge_into_test_b
       ) t
       where rk = 1
   ) b
   on a.name = b.name
   when matched and a.is_valid = 0 and b.ts > a.ts then update set *
   when matched and a.is_valid = 1 and b.ts > a.ts then update set a.score = 
b.score, a.ts = b.ts
   when not matched then insert *;
   `
   May you help me to solve this err
   @RussellSpitzer


-- 
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