apache/beam · error · RuntimeException
in schema is not supported while writing. Please provide…
Error message
${fieldType.getTypeName().name()} in schema is not supported while writing. Please provide statement and preparedStatementSetter What it means
JdbcUtil.getPreparedStatementSetCaller looks up a PreparedStatementSetCaller for each field's TypeName in typeNamePsSetCallerMap. If the schema contains a type with no registered setter (an unsupported logical/unknown type), it throws this RuntimeException telling the user to supply a custom statement and setter.
Solutions
- Convert unsupported fields to a supported type (String, Long, Double, BigDecimal, byte[], etc.) in a DoFn/map before writing.
- Use JdbcIO.write() with withStatement() and withPreparedStatementSetter() to bind the field manually.
- Register custom support upstream if the type is broadly needed, or check JdbcUtil's supported TypeName map and align the schema.
Example fix
// before
schema = Schema.builder().addUuidField("id").build(); // UUID logical type unsupported
// after
schema = Schema.builder().addStringField("id").build(); // convert UUID to String before write Defensive patterns
Strategy: fallback
Validate before calling
// pre-check field types against JDBC-supported TypeNames before writing
for (Schema.Field f : schema.getFields()) {
if (!SUPPORTED_TYPE_NAMES.contains(f.getType().getTypeName())) {
throw new IllegalArgumentException("Field '" + f.getName() + "' needs conversion or custom setter: "
+ f.getType().getTypeName());
}
} Try / catch
try {
rows.apply(JdbcIO.<Row>writeWithSchema());
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().endsWith("Please provide statement and preparedStatementSetter")) {
// rebuild write with withStatement()/withPreparedStatementSetter() handling the unsupported type
}
throw e;
} Prevention
- Normalize schemas (flatten logical types) to JDBC-supported types before the write step.
- Check JdbcUtil's typeNamePsSetCallerMap coverage when upgrading Beam versions.
- Prefer withPreparedStatementSetter() for exotic columns rather than relying on schema inference.
When it happens
Trigger: Writing a Beam Row via JdbcIO where the schema includes a field whose TypeName has no mapping in JdbcUtil (e.g. certain logical types, BYTES-adjacent custom logical types, ITERABLE, MAP/ROW nested types).
Common situations: Schemas inferred from Avro/Proto or other sources include logical types (e.g. decimal variants, UUID logical type) that JDBC writers don't map; upgrading Beam introduces new logical types not yet supported by the JDBC writer.
Related errors
- char type not supported yet…
- Converting BigQuery type
- Converting to Beam schema type is not supported
- Field type not supported when converting between JSON and…
- The type is not supported
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/84eda80d38aa2305.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcUtil.java:349
}
};
} else if (logicalTypeName.equals("OTHER")) {
return (element, ps, i, fieldWithIndex) ->
ps.setObject(
i + 1, element.getValue(fieldWithIndex.getIndex()), java.sql.Types.OTHER);
} else {
// generic beam logic type (such as portable logical types)
return getPreparedStatementSetCaller(logicalType.getBaseType());
}
}
default:
{
JdbcIO.PreparedStatementSetCaller pssc =
typeNamePsSetCallerMap.get(fieldType.getTypeName());
if (pssc != null) {
return pssc;
} else {
throw new RuntimeException(
fieldType.getTypeName().name()
+ " in schema is not supported while writing. Please provide statement and"
+ " preparedStatementSetter");
}
}
}
}
@SuppressWarnings("nullness") // ps.setArray not annotated to allow a null
private static void setArrayNull(PreparedStatement ps, int i) throws SQLException {
ps.setArray(i + 1, null);
}
static void setNullToPreparedStatement(PreparedStatement ps, int i, JDBCType type)
throws SQLException {
ps.setNull(i + 1, type.getVendorTypeNumber());
}
View on GitHub (pinned to 12126d8942)