apache/beam · error · java.lang.UnsupportedOperationException
Writing of MAP type is not supported by the default UserData
Error message
Writing of MAP type is not supported by the default UserDataMapper
What it means
This is the default branch of convertFieldToString in the default SingleStoreUserDataMapper. Note that the MAP case above it throws the same-family "MAP not supported" message; any field type not explicitly handled (e.g. MAP and other exotic type names) reaches the default branch, which formats the type name into an UnsupportedOperationException. Line 96 corresponds to the MAP branch throwing "Writing of MAP type is not supported by the default UserDataMapper".
Source
Thrown at sdks/java/io/singlestore/src/main/java/org/apache/beam/sdk/io/singlestore/SingleStoreDefaultUserDataMapper.java:96
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()));
}
}
@Override
public List<String> mapRow(Row element) {
List<String> res = new ArrayList<>();
Schema s = element.getSchema();
for (int i = 0; i < s.getFieldCount(); i++) {
res.add(convertFieldToString(s.getField(i).getType(), element.getValue(i)));
}
return res;
}
}View on GitHub (pinned to 12126d8942)
Solutions
- Convert map fields to JSON strings before writing
- Normalize maps into key/value rows or scalar columns
- Provide a custom UserDataMapper that serializes maps
Example fix
// before // field type MAP<STRING,STRING> -> throws // after // field type STRING; new ObjectMapper().writeValueAsString(map)
Defensive patterns
Strategy: validation
Validate before calling
boolean hasMap = schema.getFields().stream().anyMatch(f -> f.getType().getTypeName() == Schema.TypeName.MAP); if (hasMap) throw new IllegalArgumentException("Serialize maps to JSON before SingleStore write"); Try / catch
try { rows.apply(SingleStoreIO.write()...); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("not supported by the default UserDataMapper")) { /* flatten/map to JSON */ } throw e; } Prevention
- Treat the default UserDataMapper as scalar-only: convert nested structures upstream
- Add a schema lint step that rejects MAP/ARRAY/ITERABLE/ROW fields at graph construction time
- Keep a JSON-encoding helper handy for map-shaped fields
When it happens
Trigger: SingleStoreIO.write() with the default UserDataMapper where a Row field's Schema.FieldType has TypeName MAP (or any unhandled type reaching the default branch).
Common situations: Writing map/dictionary-valued fields (e.g. from JSON or protobuf map fields) directly to SingleStore.
Related errors
- Writing of ARRAY type is not supported by the default UserDa
- Writing of ITERABLE type is not supported by the default Use
- Converting %s to Beam schema type is not supported
- Failed to get number of partitions in the database
- ResultSetMetaData is null
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/88364743d00d7267.
Report an issue: GitHub.