apache/seatunnel · warning

The delete table {} is not equal to the target table {}

Error message

The delete table {} is not equal to the target table {}

What it means

This warning is logged by the Iceberg catalog's executeSql when a DELETE statement's table path does not match the target table path the SQL was applied against. The library only warns (does not fail) because it already resolved the delete target from the statement; a mismatch signals the delete may be applied against an unexpected table identity, e.g. a fully-qualified name whose database differs from the connection's tablePath. It exists to surface potentially mis-scoped DELETE operations in mixed-catalog or default-database setups.

Source

Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java:241

    @Override
    public void executeSql(TablePath tablePath, String sql) {
        Delete delete;
        try {
            Statement statement = CCJSqlParserUtil.parse(sql);
            delete = (Delete) statement;
        } catch (Throwable e) {
            throw new IllegalArgumentException(
                    "Only support sql: delete from ... where ..., Not support: " + sql, e);
        }

        TablePath targetTablePath = TablePath.of(delete.getTable().getFullyQualifiedName(), false);
        if (targetTablePath.getDatabaseName() == null) {
            targetTablePath =
                    TablePath.of(tablePath.getDatabaseName(), targetTablePath.getTableName());
        }
        if (!targetTablePath.equals(tablePath)) {
            log.warn(
                    "The delete table {} is not equal to the target table {}",
                    targetTablePath,
                    tablePath);
        }

        TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(targetTablePath);
        Table table = catalog.loadTable(icebergTableIdentifier);
        Expression expression = ExpressionUtils.convert(delete.getWhere(), table.schema());
        catalog.loadTable(icebergTableIdentifier)
                .newDelete()
                .deleteFromRowFilter(expression)
                .commit();
        log.info(
                "Delete table {} data success, sql [{}] to deleteFromRowFilter: {}",
                targetTablePath,
                sql,
                expression);
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Include the exact database qualifier in the DELETE statement so it matches the target tablePath (e.g. DELETE FROM mydb.mytable ...)
  2. Verify the tablePath passed to executeSql matches the fully-qualified name in the SQL (same database and table, case-sensitive)
  3. If the mismatch is intentional (default-database resolution), ignore the warning or qualify the name to silence it
  4. Check TablePath.of(..., false) normalization: ensure no catalog prefix leaks into the parsed name

Example fix

// before
catalog.executeSql(tablePath, "DELETE FROM mytable WHERE id < 100");
// after
catalog.executeSql(tablePath, "DELETE FROM mydb.mytable WHERE id < 100");
Defensive patterns

Strategy: validation

Validate before calling

TablePath deletePath = TablePath.of(delete.getTable().getFullyQualifiedName(), false);
if (deletePath.getDatabaseName() == null) {
    deletePath = TablePath.of(tablePath.getDatabaseName(), deletePath.getTableName());
}
if (!deletePath.equals(tablePath)) {
    throw new IllegalArgumentException("DELETE target " + deletePath + " != target table " + tablePath);
}

Type guard

boolean deleteTargetsSameTable(Delete delete, TablePath tablePath) {
    TablePath p = TablePath.of(delete.getTable().getFullyQualifiedName(), false);
    if (p.getDatabaseName() == null) p = TablePath.of(tablePath.getDatabaseName(), p.getTableName());
    return p.equals(tablePath);
}

Prevention

When it happens

Trigger: Calling catalog.executeSql(...) with a SQL DELETE whose table reference (delete.getTable().getFullyQualifiedName()) resolves to a TablePath different from the tablePath argument, typically when the delete statement omits or uses a different database qualifier than the target tablePath.

Common situations: Running DELETE FROM tableName without a database prefix while the connection targets a different database; case-sensitivity or catalog-name prefix differences (e.g. 'catalog.db.table' vs 'db.table'); copying SQL from another environment pointing at a stale database.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/8bfb3cb931b18da3. Report an issue: GitHub.