danielcweeks commented on code in PR #8086:
URL: https://github.com/apache/iceberg/pull/8086#discussion_r1267120790
##########
spark/v3.4/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/CreateOrReplaceTagExec.scala:
##########
@@ -50,15 +51,19 @@ case class CreateOrReplaceTagExec(
"Cannot complete create or replace tag operation on %s, main has no
snapshot", ident)
val manageSnapshot = iceberg.table.manageSnapshots()
- if (!replace) {
+ if (create && replace && null == iceberg.table().refs().get(tag)) {
Review Comment:
This is a little hard to reason through, what about simplifying to something
more like:
```scala
val exists = null == iceberg.table().refs().get(tag)
if (create && !exists) {
if (exists && ifNotExists) {
return Nil
}
manageSnapshot.createTag(tag, snapshotId)
} else if (replace && exists) {
manageSnapshot.replaceTag(tag, snapshotId)
}
```
--
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]