apache/seatunnel · error · DatabendConnectorException
SQL_OPERATION_FAILED
SQL_OPERATION_FAILED
Error message
Failed to convert ResultSet to SeaTunnelRow: ${e.getMessage()} What it means
Inside convertToSeaTunnelRow, any exception raised while reading ResultSet columns and building the SeaTunnelRow is caught, logged, and rethrown as DatabendConnectorException with code SQL_OPERATION_FAILED and message 'Failed to convert ResultSet to SeaTunnelRow'. It wraps type-conversion failures, column index/type mismatches, or a closed/ exhausted ResultSet.
Source
Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/util/DatabendUtil.java:166
log.info(
"Field {} ({}) [{}]: {} ({})",
i,
fieldName,
fieldType.getSqlType(),
value,
value.getClass().getSimpleName());
}
} catch (SQLException e) {
log.error("Error getting field {} ({}): {}", i, fieldName, e.getMessage());
fields[i] = null;
}
}
SeaTunnelRow row = new SeaTunnelRow(fields);
return row;
} catch (Exception e) {
log.error("Failed to convert ResultSet to SeaTunnelRow: {}", e.getMessage());
throw new DatabendConnectorException(
DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
"Failed to convert ResultSet to SeaTunnelRow: " + e.getMessage(),
e);
}
}
private static Object getFieldValue(
ResultSet resultSet, int columnIndex, SeaTunnelDataType<?> fieldType)
throws SQLException {
try {
if (fieldType instanceof BasicType) {
BasicType basicType = (BasicType) fieldType;
switch (basicType.getSqlType()) {
case STRING:
return resultSet.getString(columnIndex);
case INT:
int intValue = resultSet.getInt(columnIndex);
return resultSet.wasNull() ? null : intValue;View on GitHub (pinned to cf67b549a7)
Solutions
- Compare the actual Databend table columns/types with the declared SeaTunnelRowType and re-sync the schema (re-run schema extraction or update the schema config)
- Avoid unsupported column types (or cast them to supported types in the query, e.g. TO_VARCHAR(variant_col))
- Check the wrapped cause for 'ResultSet closed' or connection errors - if so, fix connection stability rather than the schema
- Read the e.getMessage() in the exception/log line to identify the exact column index and conversion that failed
Example fix
// before SELECT id, attrs FROM my_table -- attrs is VARIANT, unsupported // after SELECT id, TO_JSON(attrs) AS attrs_str FROM my_table -- cast to supported string type
Defensive patterns
Strategy: try-catch
Validate before calling
// verify table schema matches declared rowType before running
ResultSetMetaData md = resultSet.getMetaData();
if (md.getColumnCount() != rowType.getFieldNames().length) throw new IllegalStateException("Schema drift detected"); Try / catch
try { row = DatabendUtil.convertToSeaTunnelRow(rs, rowType); } catch (DatabendConnectorException e) {
log.error("Row conversion failed: {}", e.getCause(), e);
throw e; // treat as dirty-record or schema-drift failure
} Prevention
- Keep declared SeaTunnelRowType in sync with the live Databend table schema; re-derive schema on table changes
- Cast unsupported types (VARIANT, ARRAY) to strings in the SELECT statement
- Add dirty-data handling so one bad row does not stop the whole pipeline
When it happens
Trigger: A ResultSet column type not mappable to the declared SeaTunnel type (e.g. unsupported SQL type); reading column i beyond available columns; calling getters after the ResultSet was closed or after next() returned false; null handling mismatch with the declared field type.
Common situations: Schema drift: the Databend table was altered after the job's row type was derived; custom/complex column types (ARRAY, VARIANT) not supported by the converter; connection dropped mid-result-set streaming.
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/47a93b1b14edd6e5.
Report an issue: GitHub.