This is an automated email from the ASF dual-hosted git repository.

dailai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 314b0587f2 [Fix][Connector-V2] Respect Paimon alter table ignore flag 
(#11009)
314b0587f2 is described below

commit 314b0587f28ebcefa0d096451d349cf58fb1c313
Author: QuakeWang <[email protected]>
AuthorDate: Wed Jun 10 16:36:11 2026 +0800

    [Fix][Connector-V2] Respect Paimon alter table ignore flag (#11009)
    
    Signed-off-by: QuakeWang <[email protected]>
---
 .../seatunnel/paimon/catalog/PaimonCatalog.java    | 14 +++++++----
 .../paimon/catalog/PaimonCatalogTest.java          | 27 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git 
a/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java
 
b/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java
index 5186ac955a..d169380047 100644
--- 
a/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java
+++ 
b/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java
@@ -358,9 +358,12 @@ public class PaimonCatalog implements Catalog, PaimonTable 
{
     public void alterTable(
             Identifier identifier, SchemaChange schemaChange, boolean 
ignoreIfNotExists) {
         try {
-            catalog.alterTable(identifier, schemaChange, true);
+            catalog.alterTable(identifier, schemaChange, ignoreIfNotExists);
         } catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
-            throw new CatalogException("TableNotExistException: {}", e);
+            throw new TableNotExistException(
+                    this.catalogName,
+                    TablePath.of(identifier.getDatabaseName(), 
identifier.getTableName()),
+                    e);
         } catch (org.apache.paimon.catalog.Catalog.ColumnAlreadyExistException 
e) {
             throw new CatalogException("ColumnAlreadyExistException: {}", e);
         } catch (org.apache.paimon.catalog.Catalog.ColumnNotExistException e) {
@@ -371,9 +374,12 @@ public class PaimonCatalog implements Catalog, PaimonTable 
{
     public void alterTable(
             Identifier identifier, List<SchemaChange> schemaChanges, boolean 
ignoreIfNotExists) {
         try {
-            catalog.alterTable(identifier, schemaChanges, true);
+            catalog.alterTable(identifier, schemaChanges, ignoreIfNotExists);
         } catch (org.apache.paimon.catalog.Catalog.TableNotExistException e) {
-            throw new CatalogException("TableNotExistException: {}", e);
+            throw new TableNotExistException(
+                    this.catalogName,
+                    TablePath.of(identifier.getDatabaseName(), 
identifier.getTableName()),
+                    e);
         } catch (org.apache.paimon.catalog.Catalog.ColumnAlreadyExistException 
e) {
             throw new CatalogException("ColumnAlreadyExistException: {}", e);
         } catch (org.apache.paimon.catalog.Catalog.ColumnNotExistException e) {
diff --git 
a/seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalogTest.java
 
b/seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalogTest.java
index ddfad44883..7db3a54625 100644
--- 
a/seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalogTest.java
+++ 
b/seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalogTest.java
@@ -24,6 +24,7 @@ import org.apache.seatunnel.api.table.catalog.PrimaryKey;
 import org.apache.seatunnel.api.table.catalog.TableIdentifier;
 import org.apache.seatunnel.api.table.catalog.TablePath;
 import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.catalog.exception.TableNotExistException;
 import org.apache.seatunnel.api.table.type.ArrayType;
 import org.apache.seatunnel.api.table.type.BasicType;
 import org.apache.seatunnel.api.table.type.DecimalType;
@@ -32,6 +33,10 @@ import org.apache.seatunnel.api.table.type.MapType;
 import 
org.apache.seatunnel.connectors.seatunnel.paimon.exception.PaimonConnectorErrorCode;
 import 
org.apache.seatunnel.connectors.seatunnel.paimon.exception.PaimonConnectorException;
 
+import org.apache.paimon.catalog.Identifier;
+import org.apache.paimon.schema.SchemaChange;
+import org.apache.paimon.types.DataTypes;
+
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -41,6 +46,7 @@ import lombok.extern.slf4j.Slf4j;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -255,6 +261,27 @@ public class PaimonCatalogTest {
                 });
     }
 
+    @Test
+    public void alterTableShouldRespectIgnoreIfNotExists() {
+        Identifier identifier = Identifier.create(DATABASE_NAME, 
"missing_table");
+        SchemaChange change = SchemaChange.addColumn("new_column", 
DataTypes.STRING());
+
+        Assertions.assertThrows(
+                TableNotExistException.class,
+                () -> paimonCatalog.alterTable(identifier, change, false));
+        Assertions.assertDoesNotThrow(() -> 
paimonCatalog.alterTable(identifier, change, true));
+
+        Assertions.assertThrows(
+                TableNotExistException.class,
+                () ->
+                        paimonCatalog.alterTable(
+                                identifier, Collections.singletonList(change), 
false));
+        Assertions.assertDoesNotThrow(
+                () ->
+                        paimonCatalog.alterTable(
+                                identifier, Collections.singletonList(change), 
true));
+    }
+
     @AfterEach
     public void after() {
         paimonCatalog.dropDatabase(TablePath.of(DATABASE_NAME, TABLE_NAME), 
false);

Reply via email to