NestDream opened a new issue, #9945:
URL: https://github.com/apache/paimon/issues/9945

   ### Search before asking
   - [x] I searched in the issues and found nothing similar.
   
   ### Paimon version
   master (8b7fbffcc). release-1.2 through 2.1 have the same code.
   
   ### Compute Engine
   Flink 1.20.1 (Flink 1.19+ named-argument form of the procedure).
   
   ### Minimal reproduce step
   ```sql
   CREATE TABLE T (id STRING, name STRING, PRIMARY KEY (id) NOT ENFORCED) WITH 
('bucket' = '1');
   INSERT INTO T VALUES ('1', 'a');
   INSERT INTO T VALUES ('2', 'b');
   INSERT INTO T VALUES ('3', 'c');
   CALL sys.create_tag(`table` => 'default.T', tag => 'tag-1', snapshot_id => 
1);
   
   -- 1. neither snapshot_id nor tag
   CALL sys.rollback_to(`table` => 'default.T');
   
   -- 2. both snapshot_id and tag
   CALL sys.rollback_to(`table` => 'default.T', tag => 'tag-1', snapshot_id => 
2);
   ```
   
   ### What doesn't meet your expectations?
   1. The first call fails with `TableException: The call method caused an 
error: Cannot invoke "java.lang.Long.longValue()" because "snapshotId" is 
null.` (on JDK 11 just `The call method caused an error: null.`). It is a bare 
NPE from unboxing the null `Long snapshotId` in `RollbackToProcedure`, nothing 
tells the user which argument is missing.
   2. The second call succeeds, rolls the table back to the tag (snapshot 1) 
and ignores `snapshot_id => 2`. It returns `(3, 1)` and `SELECT * FROM T` shows 
only `('1', 'a')`, although the user asked for snapshot 2.
   
   Expected: an argument error in both cases, like the Spark 
`RollbackProcedure` (`only can set one of version/snapshot/tag`) and the Flink 
`rollback_to_as_latest` procedure in the same package (`Must specify exactly 
one of tag and snapshot_id.`).
   
   ### Anything else?
   `rollback_to_timestamp` and `rollback_to_watermark` are not affected (single 
required argument). The Flink 1.18 module uses positional overloads with a 
primitive `long` and is not affected either. The docs list the arguments as 
`snapshotId` and `tagName` while the named arguments are `snapshot_id` and 
`tag`.
   
   ### Are you willing to submit a PR?
   - [x] I'm willing to submit a PR!
   


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

Reply via email to