From 8cec8c10bd34fa73f6e403bb59bccde01f3385dc Mon Sep 17 00:00:00 2001 From: Askwang <135721692+Askwang@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:26:03 +0800 Subject: [PATCH] 1 --- .../src/main/java/org/apache/paimon/utils/TagManager.java | 5 ++++- .../spark/procedure/CreateAndDeleteTagProcedureTest.scala | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java index 8aecb1ab70ac..c3a674bc5eaf 100644 --- a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java +++ b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java @@ -188,7 +188,10 @@ public void deleteTag( List callbacks) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(tagName), "Tag name '%s' is blank.", tagName); - checkArgument(tagExists(tagName), "Tag '%s' doesn't exist.", tagName); + if (!tagExists(tagName)) { + LOG.warn("Tag '{}' doesn't exist.", tagName); + return; + } Snapshot taggedSnapshot = taggedSnapshot(tagName); List taggedSnapshots; diff --git a/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/procedure/CreateAndDeleteTagProcedureTest.scala b/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/procedure/CreateAndDeleteTagProcedureTest.scala index 3dc90db0016a..3621d44b8395 100644 --- a/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/procedure/CreateAndDeleteTagProcedureTest.scala +++ b/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/procedure/CreateAndDeleteTagProcedureTest.scala @@ -191,4 +191,12 @@ class CreateAndDeleteTagProcedureTest extends PaimonSparkTestBase with StreamTes } } } + + test("Paimon Procedure: delete tag not failed if tag not exists") { + spark.sql("CREATE TABLE T (id STRING, name STRING) USING PAIMON") + + checkAnswer( + spark.sql("CALL paimon.sys.delete_tag(table => 'test.T', tag => 'test_tag')"), + Row(true) :: Nil) + } }