{"record":{"id":"af105b0bfec1b8b2","repo":"apache/beam","slug":"unsupported-type-field-gettype","errorCode":null,"errorMessage":"Unsupported type \" + field.getType()","messagePattern":"Unsupported type \" \\+ field\\.getType\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProto.java","lineNumber":295,"sourceCode":"              \"Unexpected null element type for the map's key on \" + field.getName());\n        }\n        if (valueType == null) {\n          throw new RuntimeException(\n              \"Unexpected null element type for the map's value on \" + field.getName());\n        }\n\n        builder =\n            builder\n                .setType(TableFieldSchema.Type.STRUCT)\n                .addFields(fieldDescriptorFromBeamField(Field.of(\"key\", keyType)))\n                .addFields(fieldDescriptorFromBeamField(Field.of(\"value\", valueType)))\n                .setMode(TableFieldSchema.Mode.REPEATED);\n        break;\n      default:\n        @Nullable\n        TableFieldSchema.Type primitiveType = PRIMITIVE_TYPES.get(field.getType().getTypeName());\n        if (primitiveType == null) {\n          throw new RuntimeException(\"Unsupported type \" + field.getType());\n        }\n        builder = builder.setType(primitiveType);\n    }\n    if (builder.getMode() != TableFieldSchema.Mode.REPEATED) {\n      if (field.getType().getNullable()) {\n        builder = builder.setMode(TableFieldSchema.Mode.NULLABLE);\n      } else {\n        builder = builder.setMode(TableFieldSchema.Mode.REQUIRED);\n      }\n    }\n    if (field.getDescription() != null) {\n      builder = builder.setDescription(field.getDescription());\n    }\n    return builder.build();\n  }\n\n  @Nullable\n  private static Object messageValueFromRowValue(","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProto.java#L277-L313","documentation":"In the default branch of fieldDescriptorFromBeamField, the field's type name is looked up in PRIMITIVE_TYPES to find the equivalent BigQuery TableFieldSchema.Type. If the Beam type is neither a known primitive nor one of the earlier-handled rows/arrays/maps/logical types, there is no BigQuery representation and the converter throws.","triggerScenarios":"Converting a schema containing exotic TypeNames that PRIMITIVE_TYPES does not cover (e.g. certain BYTE/iterator/struct variants depending on Beam version, DATETIME-mismatches, or nested ITERABLE-of-ITERABLE) into a BigQuery Storage API TableSchema.","commonSituations":"PCollection rows with arbitrary nested Java types auto-inferred by schemas; migrating pipelines from non-BigQuery sinks; Beam versions where newer TypeNames are not yet in PRIMITIVE_TYPES.","solutions":["Change the offending field to a BigQuery-supported primitive (STRING, INT64, FLOAT64, NUMERIC, BOOL, BYTES, TIMESTAMP, DATE, DATETIME, TIME, GEOGRAPHY as supported).","Flatten or re-shape unsupported nested types (e.g. iterable of iterable) into STRUCT/ARRAY forms BigQuery supports.","If building Beam from source, add the mapping to PRIMITIVE_TYPES.","Upgrade Beam - newer versions may have extended PRIMITIVE_TYPES coverage."],"exampleFix":"// before\nFieldType f = FieldType.iterator(FieldType.iterator(FieldType.int64())); // nested iterable\n// after\nFieldType f = FieldType.array(FieldType.array(FieldType.int64())); // ARRAY<ARRAY<INT64>> if supported, or flatten","handlingStrategy":"validation","validationCode":"Set<Schema.TypeName> supported = Set.of(Schema.TypeName.STRING, Schema.TypeName.INT64, Schema.TypeName.INT32,\n    Schema.TypeName.FLOAT, Schema.TypeName.DOUBLE, Schema.TypeName.BOOLEAN, Schema.TypeName.BYTES,\n    Schema.TypeName.DATETIME, Schema.TypeName.DECIMAL, Schema.TypeName.ROW, Schema.TypeName.ARRAY, Schema.TypeName.ITERABLE, Schema.TypeName.MAP);\nfor (Schema.Field f : schema.getFields()) {\n  if (!supported.contains(f.getType().getTypeName()))\n    throw new IllegalArgumentException(\"Field \" + f.getName() + \" type unsupported: \" + f.getType());\n}","typeGuard":"boolean isBigQueryCompatible(Schema.FieldType t) {\n  return PRIMITIVE_TYPES.containsKey(t.getTypeName())\n      || t.getTypeName() == Schema.TypeName.ROW\n      || t.getTypeName() == Schema.TypeName.ARRAY\n      || t.getTypeName() == Schema.TypeName.ITERABLE\n      || t.getTypeName() == Schema.TypeName.MAP\n      || t.getTypeName() == Schema.TypeName.LOGICAL_TYPE;\n}","tryCatchPattern":"try {\n  return BeamRowToStorageApiProto.protoTableSchemaFromBeamSchema(schema);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unsupported type\")) {\n    throw new IllegalArgumentException(\"Reshape field for BigQuery: \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["Restrict record types to BigQuery-compatible primitives","Flatten nested iterables before the sink","Check PRIMITIVE_TYPES coverage when upgrading Beam"],"tags":["java","apache-beam","bigquery","schema-mapping"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}