{"record":{"id":"3eff19021f1e6d5b","repo":"apache/beam","slug":"unsupported-logical-type-field-gettype","errorCode":null,"errorMessage":"Unsupported logical type \" + field.getType()","messagePattern":"Unsupported logical 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":267,"sourceCode":"          throw new RuntimeException(\"Unexpected null logical type \" + field.getType());\n        }\n        @Nullable TableFieldSchema.Type type;\n        if (logicalType.getIdentifier().equals(Timestamp.IDENTIFIER)) {\n          int precision =\n              Preconditions.checkNotNull(\n                  logicalType.getArgument(),\n                  \"Expected logical type argument for timestamp precision.\");\n          if (precision != 9) {\n            throw new RuntimeException(\n                \"Unsupported precision for Timestamp logical type \" + precision);\n          }\n          // Map Timestamp.NANOS logical type to BigQuery TIMESTAMP(12) for nanosecond precision\n          type = TableFieldSchema.Type.TIMESTAMP;\n          builder.setTimestampPrecision(Int64Value.newBuilder().setValue(12L).build());\n        } else {\n          type = LOGICAL_TYPES.get(logicalType.getIdentifier());\n          if (type == null) {\n            throw new RuntimeException(\"Unsupported logical type \" + field.getType());\n          }\n        }\n        builder = builder.setType(type);\n        break;\n      case MAP:\n        @Nullable FieldType keyType = field.getType().getMapKeyType();\n        @Nullable FieldType valueType = field.getType().getMapValueType();\n        if (keyType == null) {\n          throw new RuntimeException(\n              \"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","sourceCodeStart":249,"sourceCodeEnd":285,"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#L249-L285","documentation":"During Beam-schema-to-BigQuery-schema conversion, a field whose type is a logical type is looked up in the static LOGICAL_TYPES identifier-to-BigQuery-type map. If the logical type's identifier is not registered there, the converter cannot map it to a BigQuery TableFieldSchema.Type and throws. Only a fixed set of known logical types is supported.","triggerScenarios":"protoTableSchemaFromBeamSchema/fieldDescriptorFromBeamField encountering FieldType.logicalType(<custom>) whose getIdentifier() is absent from LOGICAL_TYPES, e.g. a user-defined LogicalType, SqlTypes like UUID/Json in versions where they are unmapped, or an Enumeration logical type.","commonSituations":"Using custom logical types from Beam SQL or application-specific LogicalType implementations with the BigQuery Storage Write sink; upgrading Beam and gaining new logical types not yet mapped by this converter.","solutions":["Replace the unsupported logical type with a supported one or with its base representation (e.g. use FieldType.STRING or BYTES for custom logical types).","Register the identifier by adding an entry to LOGICAL_TYPES in BeamRowToStorageApiProto if you build Beam from source.","Convert the logical type back to its base type before handing the schema to the sink (field.getType().getLogicalType().getBaseType() style re-typing).","Check whether a newer Beam version maps this logical type; upgrade the google-cloud-platform IO SDK."],"exampleFix":"// before\nFieldType uuid = FieldType.logicalType(new UuidLogicalType());\n// after\nFieldType uuid = FieldType.string(); // store UUID as STRING","handlingStrategy":"validation","validationCode":"for (Schema.Field f : schema.getFields()) {\n  if (f.getType().getTypeName() == Schema.TypeName.LOGICAL_TYPE) {\n    String id = f.getType().getLogicalType().getIdentifier();\n    if (!SUPPORTED_IDS.contains(id)) throw new IllegalArgumentException(\"Unsupported logical type: \" + id);\n  }\n}","typeGuard":"boolean isMappableLogicalType(Schema.FieldType t) {\n  return t.getTypeName() != Schema.TypeName.LOGICAL_TYPE || t.getLogicalType() != null;\n}","tryCatchPattern":"try {\n  return BeamRowToStorageApiProto.protoTableSchemaFromBeamSchema(schema);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unsupported logical type\")) {\n    return convertWithBaseTypes(schema); // degrade logical types to base types\n  }\n  throw e;\n}","preventionTips":["Stick to the documented set of logical types for BigQuery sinks","Convert custom logical types to STRING/BYTES at source","Pin and test against a specific Beam version before upgrading"],"tags":["java","apache-beam","bigquery","logical-type"],"backgroundTag":"unsupported-operation","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"}