apache/seatunnel · error · org.apache.seatunnel.api.table.catalog.exception.CatalogException
create table error
Error message
create table error
What it means
MaxComputeCatalog.createTable executes a CREATE TABLE SQL task (optionally from a user template) via SQLTask.run(...).waitForSuccess() and wraps any OdpsException in a CatalogException with this message. Failure can come from invalid DDL, template mis-rendering, permissions, or task execution errors.
Source
Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java:213
odpsTable.getComment(),
catalogName);
}
@Override
public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)
throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {
try {
Odps odps = getOdps(tablePath.getDatabaseName(), tablePath.getSchemaName());
SQLTask.run(
odps,
MaxComputeCatalogUtil.getCreateTableStatement(
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 {View on GitHub (pinned to cf67b549a7)
Solutions
- Check the cause OdpsException / task instance log for the SQL error
- Validate the rendered DDL (log or run it manually in MaxCompute console / odpscmd)
- Fix the save_mode_create_template so it produces valid MaxCompute DDL
- Grant CreateTable permission to the configured account
Example fix
// before
// template with unsupported placeholder or MySQL-specific syntax
"CREATE TABLE ${table} (${columns}) ENGINE=InnoDB;"
// after
"CREATE TABLE IF NOT EXISTS ${table} (${columns});" Defensive patterns
Strategy: validation
Validate before calling
// validate the rendered DDL before executing
ddl = "CREATE TABLE IF NOT EXISTS " + tablePath.getTableName() + " (" + columns + ");";
if (!ddl.trim().toUpperCase().startsWith("CREATE TABLE")) {
throw new IllegalArgumentException("save_mode_create_template must render a CREATE TABLE statement");
} Try / catch
try {
catalog.createTable(tablePath, catalogTable, false, java.util.Collections.emptyList());
} catch (CatalogException e) {
if (e.getCause() instanceof OdpsException
&& String.valueOf(e.getCause().getMessage()).contains("TableExistException")) {
LOG.warn("Table {} already exists, skipping create", tablePath);
return;
}
throw e;
} Prevention
- Use IF NOT EXISTS in your create template
- Test your save_mode_create_template against odpscmd with sample schemas
- Only use MaxCompute-supported types in column definitions
- Grant CreateTable permission to the runtime account
When it happens
Trigger: createTable builds DDL via MaxComputeCatalogUtil (or SAVE_MODE_CREATE_TEMPLATE) and runs it; SQLTask fails or waitForSuccess observes a failed task instance.
Common situations: Custom save_mode_create_template rendering invalid MaxCompute DDL; column names/types incompatible with MaxCompute (e.g. unsupported types); table already exists without IF NOT EXISTS; account lacks CreateTable permission.
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
- Failed EXECUTE SQL in catalog %s
- drop table error
- execute sql error
- Preview action is not supported
- Truncate table failed
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/400961c18db6cd4e.
Report an issue: GitHub.