apache/seatunnel · error · DatabendConnectorException

SQL_OPERATION_FAILED

SQL_OPERATION_FAILED

Error message

Failed to apply schema change: {e.getMessage()}

What it means

Wrapper for SQLExceptions thrown while executing DDL for a schema change against Databend. The original SQL exception is preserved as the cause. It means the ALTER/CREATE COLUMN SQL sent to Databend failed at the server.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/schema/SchemaChangeManager.java:85

                                "%s/%s", databendSinkConfig.getUrl(), tablePath.getDatabaseName()),
                        databendSinkConfig.toProperties())) {
            if (event instanceof AlterTableCommentEvent
                    || event instanceof AlterColumnCommentEvent) {
                // Comment-only changes are not supported by Databend sink, safely ignore
                log.info(
                        "Ignoring comment change event for table {} - Databend sink does not support comment sync: {}",
                        tablePath.getFullName(),
                        event.getClass().getSimpleName());
            } else if (event instanceof AlterTableColumnsEvent) {
                applySchemaChange(connection, tablePath, (AlterTableColumnsEvent) event);
            } else if (event instanceof AlterTableColumnEvent) {
                applySchemaChange(connection, tablePath, (AlterTableColumnEvent) event);
            } else {
                throw new SeaTunnelException(
                        "Unsupported schemaChangeEvent: " + event.getClass().getName());
            }
        } catch (SQLException e) {
            throw new DatabendConnectorException(
                    DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
                    "Failed to apply schema change: " + e.getMessage(),
                    e);
        }
    }

    private void applySchemaChange(
            Connection connection, TablePath tablePath, AlterTableColumnEvent event)
            throws SQLException, IOException {
        if (event instanceof AlterColumnCommentEvent) {
            // Databend does not support comment synchronization, including nested column events.
            log.info(
                    "Ignoring comment change event for table {} - Databend sink does not support comment sync: {}",
                    tablePath.getFullName(),
                    event.getClass().getSimpleName());
        } else if (event instanceof AlterTableChangeColumnEvent) {
            AlterTableChangeColumnEvent changeColumnEvent = (AlterTableChangeColumnEvent) event;
            if (!changeColumnEvent.getOldColumn().equals(changeColumnEvent.getColumn().getName())) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the cause's message for the underlying Databend server error
  2. Manually run the generated ALTER statement against Databend to see the exact failure
  3. Verify Databend user has ALTER privileges on the target table
  4. Check network connectivity and credentials to the Databend server
Defensive patterns

Strategy: try-catch

Try / catch

try {
    schemaChangeManager.applySchemaChange(event);
} catch (DatabendConnectorException e) {
    if (e.getErrorCode() == DatabendConnectorErrorCode.SQL_OPERATION_FAILED) {
        log.error("DDL failed, cause: " + e.getCause(), e);
    } else { throw e; }
}

Prevention

When it happens

Trigger: applySchemaChange executing generated DDL (add/alter/drop column) and the JDBC driver returning a SQLException — bad SQL syntax, column conflicts, permission issues, or connection drops.

Common situations: Adding a column with a type Databend rejects; altering a column in ways Databend does not support; network/auth failure mid-session; table locked or concurrently modified.

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/7883be1767228809. Report an issue: GitHub.