apache/seatunnel · error · java.lang.UnsupportedOperationException

Unsupported action type: ${actionType}

Error message

Unsupported action type: ${actionType}

What it means

previewAction only supports CREATE_TABLE, DROP_TABLE (and CREATE/alter paths via templates); any other ActionType hits the else branch and throws UnsupportedOperationException. This is a capability limitation of the MaxCompute catalog's preview implementation, not a data error.

Source

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

        } catch (OdpsException e) {
            throw new CatalogException("execute sql error", e);
        }
    }

    @Override
    public PreviewResult previewAction(
            ActionType actionType, TablePath tablePath, Optional<CatalogTable> catalogTable) {
        if (actionType == ActionType.CREATE_TABLE) {
            checkArgument(catalogTable.isPresent(), "CatalogTable cannot be null");
            return new SQLPreviewResult(
                    MaxComputeCatalogUtil.getCreateTableStatement(
                            readonlyConfig.get(MaxcomputeSinkOptions.SAVE_MODE_CREATE_TEMPLATE),
                            tablePath,
                            catalogTable.get()));
        } else if (actionType == ActionType.DROP_TABLE) {
            return new SQLPreviewResult(MaxComputeCatalogUtil.getDropTableQuery(tablePath, true));
        } else {
            throw new UnsupportedOperationException("Unsupported action type: " + actionType);
        }
    }

    /**
     * Creates an ODPS client for the given project. When {@code schemaName} is non-blank, sets it
     * as the current schema so that subsequent ODPS API calls resolve tables within that MaxCompute
     * Schema namespace.
     */
    private Odps getOdps(String project) {
        return getOdps(project, null);
    }

    private Odps getOdps(String project, String schemaName) {
        Odps odps = new Odps(account);
        odps.setEndpoint(readonlyConfig.get(MaxcomputeBaseOptions.ENDPOINT));
        odps.setDefaultProject(project);
        if (StringUtils.isNotEmpty(schemaName)) {
            odps.setCurrentSchema(schemaName);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Only call previewAction for ActionType.CREATE_TABLE and DROP_TABLE on this catalog
  2. Handle/absorb UnsupportedOperationException at the call site and skip preview for unsupported actions
  3. Upgrade SeaTunnel/connector version in case support for more action types was added
  4. Extend previewAction in MaxComputeCatalog if you need new previews

Example fix

// before
PreviewResult r = catalog.previewAction(actionType, tablePath, Optional.of(table));
// after
PreviewResult r = (actionType == ActionType.CREATE_TABLE || actionType == ActionType.DROP_TABLE)
        ? catalog.previewAction(actionType, tablePath, Optional.of(table))
        : null;
Defensive patterns

Strategy: validation

Validate before calling

Set<ActionType> supported = EnumSet.of(ActionType.CREATE_TABLE, ActionType.DROP_TABLE);
if (!supported.contains(actionType)) {
    throw new IllegalArgumentException("preview unsupported for " + actionType);
}

Try / catch

try { return catalog.previewAction(actionType, tablePath, ct); }
catch (UnsupportedOperationException e) { return null; // skip preview }

Prevention

When it happens

Trigger: Calling catalog.previewAction with an unsupported ActionType such as TRUNCATE_TABLE or other action types on MaxcomputeCatalog.

Common situations: Generic save-mode automation that previews every action type for all catalogs without checking which actions the MaxCompute catalog supports; new action types added upstream but not implemented in this connector.

Related errors


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