apache/seatunnel · error · ClickhouseConnectorException

COMMON_SQL_OPERATION_FAILED

COMMON_SQL_OPERATION_FAILED

Error message

Add row data into batch error

What it means

Wraps a SQLException thrown while adding a SeaTunnelRow to the JDBC batch statement via JdbcBatchStatementExecutor.addToBatch. It usually means the row's values do not fit the prepared INSERT statement's schema (column count, types, or format).

Source

Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/client/ClickhouseSinkWriter.java:123

                intHolder.setValue(0);
            }
        }
    }

    @Override
    public void abortPrepare() {}

    @Override
    public void close() throws IOException {
        this.proxy.close();
        flush();
    }

    private void addIntoBatch(SeaTunnelRow row, JdbcBatchStatementExecutor clickHouseStatement) {
        try {
            clickHouseStatement.addToBatch(row);
        } catch (SQLException e) {
            throw new ClickhouseConnectorException(
                    CommonErrorCodeDeprecated.SQL_OPERATION_FAILED,
                    "Add row data into batch error",
                    e);
        }
    }

    private void flush(JdbcBatchStatementExecutor clickHouseStatement) {
        try {
            clickHouseStatement.executeBatch();
        } catch (Exception e) {
            throw new ClickhouseConnectorException(
                    CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,
                    "Clickhouse execute batch statement error",
                    e);
        }
    }

    private void flush() {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Compare the SeaTunnelRow schema with the ClickHouse table schema and align columns/types
  2. Re-run schema evolution checks; restart the job so statements are re-prepared against the current schema
  3. Inspect the wrapped SQLException cause for the exact column/type mismatch
Defensive patterns

Strategy: try-catch

Validate before calling

// validate row arity/types against table schema before writing
if (row.getArity() != expectedColumnCount)
  throw new IllegalStateException("row arity " + row.getArity() + " != table columns " + expectedColumnCount);

Try / catch

try { writer.write(row); } catch (ClickhouseConnectorException e) {
  if (e.getCode().equals(CommonErrorCodeDeprecated.SQL_OPERATION_FAILED)
      && e.getMessage().contains("Add row data into batch error")) {
    log.error("schema mismatch", e.getCause()); // re-prepare statements / DLQ row
  }
}

Prevention

When it happens

Trigger: A row's field count differs from the INSERT placeholders, a value cannot be bound to the target column type, or the executor received a rowKind it cannot render; occurs in ClickhouseSinkWriter.addIntoBatch during write().

Common situations: Upstream schema changed after the writer was initialized (columns added/removed), nested/array types serialized unexpectedly, or table schema edited while the job runs.

Related errors


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