apache/seatunnel · error · org.apache.seatunnel.api.table.catalog.exception.CatalogException

drop table error

Error message

drop table error

What it means

MaxComputeCatalog.dropTable runs a DROP TABLE query (built with ignoreIfNotExists semantics) via SQLTask.run(...).waitForSuccess() and wraps any OdpsException into a CatalogException with this message. Indicates the drop task failed to submit or complete.

Source

Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java:225

                                    readonlyConfig.get(
                                            MaxcomputeSinkOptions.SAVE_MODE_CREATE_TEMPLATE),
                                    tablePath,
                                    table))
                    .waitForSuccess();
        } catch (OdpsException e) {
            throw new CatalogException("create table error", e);
        }
    }

    @Override
    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {
        try {
            Odps odps = getOdps(tablePath.getDatabaseName(), tablePath.getSchemaName());
            SQLTask.run(odps, MaxComputeCatalogUtil.getDropTableQuery(tablePath, ignoreIfNotExists))
                    .waitForSuccess();
        } catch (OdpsException e) {
            throw new CatalogException("drop table error", e);
        }
    }

    @Override
    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
            throws DatabaseAlreadyExistException, CatalogException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
            throws DatabaseNotExistException, CatalogException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the cause OdpsException and the MaxCompute instance log
  2. Set ignoreIfNotExists=true or use DROP TABLE IF EXISTS in templates
  3. Grant Drop permission on the table/project
  4. Check for table protection (enable_drop_table protection) or locks and disable/remove them

Example fix

// before
catalog.dropTable(TablePath.of("proj", "t1"), false); // fails if t1 missing
// after
catalog.dropTable(TablePath.of("proj", "t1"), true); // idempotent drop
Defensive patterns

Strategy: try-catch

Validate before calling

if (!catalog.tableExists(tablePath) && ignoreIfNotExists) {
    return; // nothing to drop
}

Try / catch

try {
    catalog.dropTable(tablePath, true);
} catch (CatalogException e) {
    if (e.getCause() instanceof OdpsException
            && String.valueOf(e.getCause().getMessage()).toLowerCase().contains("protect")) {
        throw new IllegalStateException("Table " + tablePath + " is protected; disable protection first", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: dropTable is called; SQLTask.run with getDropTableQuery throws OdpsException, or the task instance fails at waitForSuccess.

Common situations: Table does not exist and ignoreIfNotExists=false with a non-idempotent query; permission denied to drop; table is protected (cannot be dropped) or locked by a running job; network failure.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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