{"record":{"id":"400961c18db6cd4e","repo":"apache/seatunnel","slug":"create-table-error","errorCode":null,"errorMessage":"create table error","messagePattern":"create table error","errorType":"exception","errorClass":"org.apache.seatunnel.api.table.catalog.exception.CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java","lineNumber":213,"sourceCode":"                odpsTable.getComment(),\n                catalogName);\n    }\n\n    @Override\n    public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)\n            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {\n        try {\n            Odps odps = getOdps(tablePath.getDatabaseName(), tablePath.getSchemaName());\n            SQLTask.run(\n                            odps,\n                            MaxComputeCatalogUtil.getCreateTableStatement(\n                                    readonlyConfig.get(\n                                            MaxcomputeSinkOptions.SAVE_MODE_CREATE_TEMPLATE),\n                                    tablePath,\n                                    table))\n                    .waitForSuccess();\n        } catch (OdpsException e) {\n            throw new CatalogException(\"create table error\", e);\n        }\n    }\n\n    @Override\n    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)\n            throws TableNotExistException, CatalogException {\n        try {\n            Odps odps = getOdps(tablePath.getDatabaseName(), tablePath.getSchemaName());\n            SQLTask.run(odps, MaxComputeCatalogUtil.getDropTableQuery(tablePath, ignoreIfNotExists))\n                    .waitForSuccess();\n        } catch (OdpsException e) {\n            throw new CatalogException(\"drop table error\", e);\n        }\n    }\n\n    @Override\n    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)\n            throws DatabaseAlreadyExistException, CatalogException {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java#L195-L231","documentation":"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.","triggerScenarios":"createTable builds DDL via MaxComputeCatalogUtil (or SAVE_MODE_CREATE_TEMPLATE) and runs it; SQLTask fails or waitForSuccess observes a failed task instance.","commonSituations":"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.","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"],"exampleFix":"// before\n// template with unsupported placeholder or MySQL-specific syntax\n\"CREATE TABLE ${table} (${columns}) ENGINE=InnoDB;\"\n// after\n\"CREATE TABLE IF NOT EXISTS ${table} (${columns});\"","handlingStrategy":"validation","validationCode":"// validate the rendered DDL before executing\nddl = \"CREATE TABLE IF NOT EXISTS \" + tablePath.getTableName() + \" (\" + columns + \");\";\nif (!ddl.trim().toUpperCase().startsWith(\"CREATE TABLE\")) {\n    throw new IllegalArgumentException(\"save_mode_create_template must render a CREATE TABLE statement\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    catalog.createTable(tablePath, catalogTable, false, java.util.Collections.emptyList());\n} catch (CatalogException e) {\n    if (e.getCause() instanceof OdpsException\n            && String.valueOf(e.getCause().getMessage()).contains(\"TableExistException\")) {\n        LOG.warn(\"Table {} already exists, skipping create\", tablePath);\n        return;\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["maxcompute","catalog","ddl","sql"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}