apache/beam · error · UnsupportedOperationException
Writing of ARRAY type is not supported by the default UserDa
Error message
Writing of ARRAY type is not supported by the default UserDataMapper
What it means
The default SingleStoreUserDataMapper serializes each field value to a string suitable for an INSERT statement. ARRAY-typed schema fields have no supported string representation here, so convertFieldToString throws UnsupportedOperationException for the ARRAY case.
Source
Thrown at sdks/java/io/singlestore/src/main/java/org/apache/beam/sdk/io/singlestore/SingleStoreDefaultUserDataMapper.java:82
return ((Integer) value).toString();
case INT64:
return ((Long) value).toString();
case DECIMAL:
return ((BigDecimal) value).toString();
case FLOAT:
return ((Float) value).toString();
case DOUBLE:
return ((Double) value).toString();
case STRING:
return (String) value;
case DATETIME:
return formatter.print((Instant) value);
case BOOLEAN:
return ((Boolean) value) ? "1" : "0";
case BYTES:
return new String((byte[]) value, StandardCharsets.UTF_8);
case ARRAY:
throw new UnsupportedOperationException(
"Writing of ARRAY type is not supported by the default UserDataMapper");
case ITERABLE:
throw new UnsupportedOperationException(
"Writing of ITERABLE type is not supported by the default UserDataMapper");
case MAP:
throw new UnsupportedOperationException(
"Writing of MAP type is not supported by the default UserDataMapper");
case ROW:
throw new UnsupportedOperationException(
"Writing of nested ROW type is not supported by the default UserDataMapper");
case LOGICAL_TYPE:
return convertLogicalTypeFieldToString(type, value);
default:
throw new UnsupportedOperationException(
String.format(
"Writing of %s type is not supported by the default UserDataMapper",
type.getTypeName().name()));
}View on GitHub (pinned to 12126d8942)
Solutions
- Flatten ARRAY fields into scalar columns or a separate table before writing
- Provide a custom UserDataMapper that serializes arrays (e.g. to JSON string) and use SingleStoreIO.write().withUserDataMapper(...)
- Store the array as a JSON/CHAR column and convert to STRING in the schema
Example fix
// before
// schema has FieldType.array(FieldType.STRING) -> throws on write
// after
rows = rows.apply(MapElements.into(TypeDescriptor.of(Row.class))
.via(r -> {
// replace array field with JSON-encoded string
...
return newRow;
})); Defensive patterns
Strategy: validation
Validate before calling
boolean hasArray = row.getSchema().getFields().stream().anyMatch(f -> f.getType().getTypeName() == Schema.TypeName.ARRAY); if (hasArray) { /* flatten or JSON-encode first */ } Try / catch
try { rows.apply(SingleStoreIO.write()...); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("ARRAY type is not supported")) { /* rewrite schema */ } throw e; } Prevention
- Check destination schema field types against SingleStoreIO's supported list (STRING/INT/BYTE/FLT/DBL/BOOL/DATETIME/LOGICAL) before wiring the sink
- Encode collections as JSON strings upstream
- Write a reusable custom UserDataMapper if arrays are central to your pipeline
When it happens
Trigger: Writing a Beam PCollection whose schema contains an ARRAY field via SingleStoreIO.write() using the default UserDataMapper; the switch case for ARRAY in convertFieldToString fires.
Common situations: Beam pipelines reading Avro/Parquet arrays and writing them straight to SingleStore; schemas auto-generated from sources with repeated fields.
Related errors
- Writing of ITERABLE type is not supported by the default Use
- Converting %s to Beam schema type is not supported
- Writing of MAP type is not supported by the default UserData
- Could not decode the value from Row
- Unsupported integer bit width: ${type.getBitWidth()}
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/1ea83f750bceaab4.
Report an issue: GitHub.