{"record":{"id":"1ea83f750bceaab4","repo":"apache/beam","slug":"writing-of-array-type-is-not-supported-by-the-default","errorCode":null,"errorMessage":"Writing of ARRAY type is not supported by the default UserDataMapper","messagePattern":"Writing of ARRAY type is not supported by the default UserDataMapper","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/singlestore/src/main/java/org/apache/beam/sdk/io/singlestore/SingleStoreDefaultUserDataMapper.java","lineNumber":82,"sourceCode":"        return ((Integer) value).toString();\n      case INT64:\n        return ((Long) value).toString();\n      case DECIMAL:\n        return ((BigDecimal) value).toString();\n      case FLOAT:\n        return ((Float) value).toString();\n      case DOUBLE:\n        return ((Double) value).toString();\n      case STRING:\n        return (String) value;\n      case DATETIME:\n        return formatter.print((Instant) value);\n      case BOOLEAN:\n        return ((Boolean) value) ? \"1\" : \"0\";\n      case BYTES:\n        return new String((byte[]) value, StandardCharsets.UTF_8);\n      case ARRAY:\n        throw new UnsupportedOperationException(\n            \"Writing of ARRAY type is not supported by the default UserDataMapper\");\n      case ITERABLE:\n        throw new UnsupportedOperationException(\n            \"Writing of ITERABLE type is not supported by the default UserDataMapper\");\n      case MAP:\n        throw new UnsupportedOperationException(\n            \"Writing of MAP type is not supported by the default UserDataMapper\");\n      case ROW:\n        throw new UnsupportedOperationException(\n            \"Writing of nested ROW type is not supported by the default UserDataMapper\");\n      case LOGICAL_TYPE:\n        return convertLogicalTypeFieldToString(type, value);\n      default:\n        throw new UnsupportedOperationException(\n            String.format(\n                \"Writing of %s type is not supported by the default UserDataMapper\",\n                type.getTypeName().name()));\n    }","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/singlestore/src/main/java/org/apache/beam/sdk/io/singlestore/SingleStoreDefaultUserDataMapper.java#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"Beam pipelines reading Avro/Parquet arrays and writing them straight to SingleStore; schemas auto-generated from sources with repeated fields.","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"],"exampleFix":"// before\n// schema has FieldType.array(FieldType.STRING) -> throws on write\n// after\nrows = rows.apply(MapElements.into(TypeDescriptor.of(Row.class))\n    .via(r -> {\n      // replace array field with JSON-encoded string\n      ...\n      return newRow;\n    }));","handlingStrategy":"validation","validationCode":"boolean hasArray = row.getSchema().getFields().stream().anyMatch(f -> f.getType().getTypeName() == Schema.TypeName.ARRAY); if (hasArray) { /* flatten or JSON-encode first */ }","typeGuard":null,"tryCatchPattern":"try { rows.apply(SingleStoreIO.write()...); } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"ARRAY type is not supported\")) { /* rewrite schema */ } throw e; }","preventionTips":["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"],"tags":["java","beam","singlestore","write","unsupported-type"],"backgroundTag":"operation-not-supported","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}