{"record":{"id":"614643227ef94bc6","repo":"apache/beam","slug":"unknown-avro-type-type-gettype","errorCode":null,"errorMessage":"Unknown Avro type: \" + type.getType()","messagePattern":"Unknown Avro type: \" \\+ type\\.getType\\(\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryAvroUtils.java","lineNumber":718,"sourceCode":"              }\n            }\n          }\n          return fieldSchema;\n        } else {\n          return fieldSchema.setType(\"BYTES\");\n        }\n      case ENUM:\n        return fieldSchema.setType(\"STRING\");\n      case FIXED:\n        return fieldSchema.setType(\"BYTES\");\n      case RECORD:\n        List<TableFieldSchema> recordFields =\n            type.getFields().stream()\n                .map(f -> fromAvroFieldSchema(f, useAvroLogicalTypes))\n                .collect(Collectors.toList());\n        return new TableFieldSchema().setType(\"RECORD\").setFields(recordFields);\n      default:\n        throw new IllegalArgumentException(\"Unknown Avro type: \" + type.getType());\n    }\n  }\n}\n","sourceCodeStart":700,"sourceCodeEnd":722,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryAvroUtils.java#L700-L722","documentation":"typedTableFieldSchema maps an Avro Schema.Type back to a BigQuery TableFieldSchema type (the inverse of Avro generation). When the Avro type is one it cannot map back (in the default branch), it throws IllegalArgumentException, since not every Avro type has a BigQuery counterpart.","triggerScenarios":"Calling typedTableFieldSchema (via fromAvroFieldSchema) on an Avro schema containing an unmappable type — e.g. MAP, FIXED, or an unexpected UNION shape — when deriving a BigQuery TableSchema from an Avro schema.","commonSituations":"Users reading Avro files into BigQuery via Beam with schemas produced by other tools containing Avro-only types, or hand-written Avro schemas that don't round-trip through BigQuery.","solutions":["Remove or convert unsupported Avro types (MAP/FIXED) to records/bytes/strings in the source schema","Handle the type explicitly before fromAvroFieldSchema","Ensure the Avro schema was originally generated from a BigQuery schema so it round-trips"],"exampleFix":"// before\nSchema mapField = SchemaBuilder.builder().map().values().stringType();\n// after\n// represent as array of records\nSchema entry = SchemaBuilder.builder().record(\"entry\").fields().requiredString(\"key\").requiredString(\"value\");\nSchema mapField = SchemaBuilder.builder().array().items(entry);","handlingStrategy":"validation","validationCode":"Set<Schema.Type> bqMappable = EnumSet.of(BOOLEAN, INT, LONG, FLOAT, DOUBLE, BYTES, STRING, RECORD, ARRAY);\nif (!bqMappable.contains(avroType.getType())) throw new IllegalArgumentException(\"Avro type \" + avroType + \" has no BigQuery counterpart\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate Avro schemas from BigQuery schemas so they round-trip","Avoid Avro MAP/FIXED types in data destined for BigQuery","Pre-convert unsupported types upstream"],"tags":["java","apache-beam","bigquery","avro","schema","unsupported-type"],"backgroundTag":"incompatible-source-type","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"}