apache/seatunnel · error · UnsupportedOperationException

Hudi catalog not support truncate table.

Error message

Hudi catalog not support truncate table.

What it means

Thrown unconditionally by HudiCatalog.truncateTable — the Hudi catalog does not implement table truncation, so any truncate request via save mode or catalog API hits this UnsupportedOperationException.

Source

Thrown at seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/catalog/HudiCatalog.java:272

            if (ignoreIfNotExists) {
                return;
            } else {
                throw new TableNotExistException(catalogName, tablePath);
            }
        }

        Path path = new Path(inferTablePath(tableParentDfsPathStr, tablePath));
        try {
            this.fs.delete(path, true);
        } catch (IOException e) {
            throw new CatalogException(String.format("Dropping table %s exception.", tablePath), e);
        }
    }

    @Override
    public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {
        throw new UnsupportedOperationException("Hudi catalog not support truncate table.");
    }

    @Override
    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
            throws DatabaseAlreadyExistException, CatalogException {
        if (databaseExists(tablePath.getDatabaseName())) {
            if (ignoreIfExists) {
                return;
            } else {
                throw new DatabaseAlreadyExistException(catalogName, tablePath.getDatabaseName());
            }
        }

        Path dbPath = new Path(tableParentDfsPath, tablePath.getDatabaseName());
        try {
            fs.mkdirs(dbPath);
        } catch (IOException e) {
            throw new CatalogException(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Do not call truncateTable on the Hudi catalog; drop and recreate the table instead.
  2. Delete table data via Hudi tooling (e.g., clean/rollback or overwrite write type) rather than catalog truncate.
  3. Guard feature flags so truncate is skipped for catalogs that do not support it.

Example fix

// before
catalog.truncateTable(tablePath, true);
// after
if (catalog.tableExists(tablePath)) {
    catalog.dropTable(tablePath, true);
    catalog.createTable(tablePath, schema, true);
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Java
if (catalog instanceof HudiCatalog) {
    throw new UnsupportedOperationException("Truncate unsupported for Hudi catalog");
}

Type guard

boolean supportsTruncate = !(catalog instanceof HudiCatalog);

Try / catch

// Java
try {
    catalog.truncateTable(tablePath, true);
} catch (UnsupportedOperationException e) {
    // fall back: drop + recreate or use Hudi overwrite/cleanup
}

Prevention

When it happens

Trigger: Any call to truncateTable(tablePath, ignoreIfNotExists), e.g., a pipeline or higher-level API that clears tables before writing invokes it on a Hudi catalog.

Common situations: Framework-level 'truncate before load' option enabled while using the Hudi catalog; generic catalog code paths assuming all catalogs support truncate.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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