{"record":{"id":"3910a7352fa758fc","repo":"apache/beam","slug":"unsupported-iterable-type-s-while-translating-row-to-struct-3910a7","errorCode":null,"errorMessage":"Unsupported iterable type '%s' while translating row to struct.","messagePattern":"Unsupported iterable type '(.+?)' while translating row to struct\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/StructUtils.java","lineNumber":349,"sourceCode":"        break;\n      case STRING:\n        structBuilder.set(column).toStringArray((Iterable<String>) ((Object) iterable));\n        break;\n        // TODO: implement logical date and datetime\n      case DATETIME:\n        if (iterable == null) {\n          structBuilder.set(column).toTimestampArray(null);\n        } else {\n          structBuilder\n              .set(column)\n              .toTimestampArray(\n                  StreamSupport.stream(iterable.spliterator(), false)\n                      .map(timestamp -> Timestamp.parseTimestamp(timestamp.toString()))\n                      .collect(toList()));\n        }\n        break;\n      default:\n        throw new IllegalArgumentException(\n            String.format(\n                \"Unsupported iterable type '%s' while translating row to struct.\",\n                beamIterableType.getTypeName()));\n    }\n  }\n\n  private static java.time.Instant fromSpannerTimestamp(Timestamp spannerTimestamp) {\n    long micros = spannerTimestamp.getSeconds() * 1_000_000L + spannerTimestamp.getNanos() / 1_000L;\n    return java.time.Instant.ofEpochSecond(micros / 1_000_000L, (micros % 1_000_000L) * 1_000L);\n  }\n\n  private static @Nullable Object getStructValue(Struct struct, Schema.Field field) {\n    String column = field.getName();\n    Type.Code typeCode = struct.getColumnType(column).getCode();\n    if (struct.isNull(column)) {\n      return null;\n    }\n    switch (typeCode) {","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/StructUtils.java#L331-L367","documentation":"addIterableToStructBuilder translates Beam array (iterable) fields into Spanner array values. If the element type of the iterable has no case in the switch, this IllegalArgumentException reports the unsupported element type. Only scalar element types (INT64, FLOAT64, STRING, BOOLEAN, TIMESTAMP, DATETIME, etc.) are supported.","triggerScenarios":"Converting a Beam Row with an ARRAY field whose collection element type is unsupported (e.g. array of DECIMAL or array of ROW) into a Spanner Struct via beamRowToStruct.","commonSituations":"Arrays of decimals/numerics from BigQuery pipelines; nested arrays produced by earlier transforms; arrays of rows from join results.","solutions":["Flatten or transform the array elements into a supported scalar type (e.g. map DECIMAL elements to STRING).","Replace array-of-struct fields with JSON-encoded STRING columns.","Verify the Row schema's collection element type with field.getType().getCollectionElementType() before conversion."],"exampleFix":"// before\nSchema.Field.of(\"prices\", Schema.FieldType.array(Schema.FieldType.DECIMAL))\n// after\nSchema.Field.of(\"prices\", Schema.FieldType.array(Schema.FieldType.FLOAT64))","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean isArrayElementTypeSupported(Schema.FieldType arrayType) {\n  Schema.FieldType el = arrayType.getCollectionElementType();\n  return el != null && switch (el.getTypeName()) {\n    case INT64, FLOAT64, STRING, BOOLEAN, DATETIME -> true;\n    default -> false;\n  };\n}","tryCatchPattern":null,"preventionTips":["Use arrays of scalar types only (INT64, FLOAT64, STRING, BOOLEAN, TIMESTAMP).","Convert arrays of structs/decimals to JSON STRING columns.","Validate collection element types in a DoFn before conversion."],"tags":["spanner","arrays","type-conversion","java"],"backgroundTag":"unsupported-dtype","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}