aokolnychyi commented on code in PR #8163:
URL: https://github.com/apache/iceberg/pull/8163#discussion_r1287823499
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/procedures/SetCurrentSnapshotProcedure.java:
##########
@@ -78,17 +83,21 @@ public StructType outputType() {
@Override
public InternalRow[] call(InternalRow args) {
Identifier tableIdent = toIdentifier(args.getString(0),
PARAMETERS[0].name());
- long snapshotId = args.getLong(1);
+ Long snapshotId = args.isNullAt(1) ? null : args.getLong(1);
+ String ref = args.isNullAt(2) ? null : args.getString(2);
+ Preconditions.checkArgument(
+ snapshotId != null || ref != null, "snapshot_id and ref cannot both be
null");
Review Comment:
I'd expect this to throw an exception if both are provided.
What about something like below?
```
Preconditions.checkArgument(
(snapshotId != null && ref == null) || (snapshotId == null && ref !=
null),
"Either snapshot_id or ref must be provided, not both");
```
--
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]