{"record":{"id":"c834b92c1f21fcee","repo":"apache/beam","slug":"converting-bigquery-type-to-is-not-supported","errorCode":null,"errorMessage":"Converting BigQuery type '' to '' is not supported","messagePattern":"Converting BigQuery type '' to '' is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java","lineNumber":991,"sourceCode":"              // If this is the case, unwrap the value first\n              .<@Nullable Object>map(\n                  v ->\n                      (!innerTypeIsMap\n                              && v instanceof Map\n                              && ((Map<String, Object>) v).keySet().equals(Sets.newHashSet(\"v\")))\n                          ? ((Map<String, Object>) v).get(\"v\")\n                          : v)\n              .<@Nullable Object>map(v -> toBeamValue(field.withType(collectionElementType), v))\n              .collect(toList());\n    }\n\n    if (jsonBQValue instanceof Map) {\n      TableRow tr = new TableRow();\n      tr.putAll((Map<String, Object>) jsonBQValue);\n      return toBeamRow(Preconditions.checkArgumentNotNull(fieldType.getRowSchema()), tr);\n    }\n\n    throw new UnsupportedOperationException(\n        \"Converting BigQuery type '\"\n            + jsonBQValue.getClass()\n            + \"' to '\"\n            + fieldType\n            + \"' is not supported\");\n  }\n\n  // TODO: BigQuery shouldn't know about SQL internal logical types.\n  private static final Set<String> SQL_DATE_TIME_TYPES = ImmutableSet.of(\"SqlTimeWithLocalTzType\");\n\n  /**\n   * Tries to convert an Avro decoded value to a Beam field value based on the target type of the\n   * Beam field.\n   *\n   * <p>For the Avro formats of BigQuery types, see\n   * https://cloud.google.com/bigquery/docs/exporting-data#avro_export_details and\n   * https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-avro#avro_conversions\n   */","sourceCodeStart":973,"sourceCodeEnd":1009,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java#L973-L1009","documentation":"Terminal UnsupportedOperationException thrown at the end of BigQueryUtils.fromJsonToBeamField when the BigQuery JSON value's runtime type (String, Number, List, Map, Boolean already handled earlier) has no conversion rule to the requested Beam FieldType. Unlike the other errors this one is not a nullability issue: it means the (javaClass, FieldType) pair is simply unsupported, e.g. a STRUCT value targeting a non-ROW type or a STRING targeting a non-primitive type.","triggerScenarios":"toBeamRow conversion where jsonBQValue's class does not match any branch of the conversion switch: e.g. a String/Number value with target FieldType DATETIME/NUMERIC without a converter, a Map whose FieldType has no row schema, or unsupported combinations like a List targeting BYTE.","commonSituations":"BigQuery types with no default Java mapping (GEOGRAPHY, JSON, NUMERIC/INTERVAL on older Beam versions, RANGE) arriving as raw JSON types; a Beam schema written for a different table version; custom logical types the converter does not know.","solutions":["Upgrade Apache Beam to a newer release where more BigQuery types (NUMERIC, GEOGRAPHY, JSON, RANGE) are supported by BigQueryUtils.","Ensure the Beam FieldType matches the BigQuery type: use FieldType.row(schema) for STRUCT/RECORD values, FieldType.DATETIME for timestamps, FieldType.DECIMAL for NUMERIC.","Register custom conversion via LogicalType or convert the value to a supported type upstream (e.g. CAST in SQL).","Add a targeted preprocessing step that normalizes unsupported values (e.g. stringify GEOGRAPHY) before toBeamRow."],"exampleFix":"// before\nField f = Field.of(\"loc\", FieldType.STRING); // BigQuery GEOGRAPHY arrives as non-string value\n\n// after\n// cast upstream: SELECT ST_AsText(loc) AS loc ...\nField f = Field.of(\"loc\", FieldType.STRING);","handlingStrategy":"try-catch","validationCode":"// Java: pre-check unsupported BigQuery type/value combos before conversion\nSet<String> unsupported = Set.of(\"GEOGRAPHY\", \"JSON\", \"RANGE\", \"INTERVAL\");\nif (unsupported.contains(tableSchema.getFields().get(name).getType())) {\n  throw new IllegalArgumentException(\"Unsupported BigQuery type for field: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try {\n  Row row = BigQueryUtils.toBeamRow(schema, tableRow);\n} catch (UnsupportedOperationException e) {\n  // value/type combo unsupported: serialize raw value or dead-letter\n}","preventionTips":["Check Beam release notes for newly supported BigQuery types before upgrading table schemas.","CAST unsupported types (GEOGRAPHY, JSON) to STRING in the extraction query.","Prefer auto-generated schemas (fromTableSchema) over hand-written FieldTypes for exotic types."],"tags":["java","apache-beam","bigquery","unsupported-type","conversion"],"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"}