{"record":{"id":"141884d9946b926d","repo":"apache/beam","slug":"unexpected-field-type-s","errorCode":null,"errorMessage":"Unexpected field type: %s","messagePattern":"Unexpected field type: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery_tools.py","lineNumber":1383,"sourceCode":"      # Input: \"2016-11-03\" --> Output: \"2016-11-03\"\n      return value\n    elif field.type == 'DATETIME':\n      # Input: \"2016-11-03T00:49:36\" --> Output: \"2016-11-03T00:49:36\"\n      return value\n    elif field.type == 'TIME':\n      # Input: \"00:49:36\" --> Output: \"00:49:36\"\n      return value\n    elif field.type == 'RECORD':\n      # Note that a schema field object supports also a RECORD type. However\n      # when querying, the repeated and/or record fields are flattened\n      # unless we pass the flatten_results flag as False to the source\n      return self.convert_row_to_dict(value, field)\n    elif field.type == 'NUMERIC':\n      return decimal.Decimal(value)\n    elif field.type == 'GEOGRAPHY':\n      return value\n    else:\n      raise RuntimeError('Unexpected field type: %s' % field.type)\n\n  def convert_row_to_dict(self, row, schema):\n    \"\"\"Converts a TableRow instance using the schema to a Python dict.\"\"\"\n    result = {}\n    for index, field in enumerate(schema.fields):\n      value = None\n      if isinstance(schema, bigquery.TableSchema):\n        cell = row.f[index]\n        value = from_json_value(cell.v) if cell.v is not None else None\n      elif isinstance(schema, bigquery.TableFieldSchema):\n        cell = row['f'][index]\n        value = cell['v'] if 'v' in cell else None\n      if field.mode == 'REPEATED':\n        if value is None:\n          # Ideally this should never happen as repeated fields default to\n          # returning an empty list\n          result[field.name] = []\n        else:","sourceCodeStart":1365,"sourceCodeEnd":1401,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery_tools.py#L1365-L1401","documentation":"Raised by `_convert_cell_value_to_dict` (called from `convert_row_to_dict`) when a BigQuery field type is not among the handled types (STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP, RECORD, NUMERIC, GEOGRAPHY, etc.). Beam encountered a table schema field type its row-to-dict converter doesn't implement, so it aborts with a RuntimeError naming the type.","triggerScenarios":"Reading/queried rows from a table whose schema includes a newer or unhandled type (e.g. JSON, RANGE, INTERVAL, or other post-support types) via convert_row_to_dict / BigQuery read paths.","commonSituations":"Tables created with recently added BigQuery types used with an older apache-beam version; mixing tools (someone altered the table schema after the pipeline was written); using Beam to read a table written by other tools with exotic types.","solutions":["Upgrade apache-beam to the latest version, which handles newer BigQuery field types.","Cast unsupported columns in your SQL (e.g. CAST(json_col AS STRING)) so the schema Beam sees only contains supported types.","Restrict the read schema (SELECT specific columns) to exclude unhandled fields.","If stuck on an old Beam version, convert the offending column's type in BigQuery (ALTER TABLE / materialized view) to a supported equivalent like STRING."],"exampleFix":"// before\nSELECT * FROM `project.dataset.table_with_json_column`\n// after\nSELECT id, CAST(json_col AS STRING) AS json_col, ts FROM `project.dataset.table_with_json_column`","handlingStrategy":"try-catch","validationCode":"SUPPORTED = {'STRING','INTEGER','FLOAT','BOOLEAN','TIMESTAMP','RECORD','NUMERIC','GEOGRAPHY','DATE','TIME','DATETIME','BYTES'}\ndef schema_types_supported(table_schema):\n    return all(f.type in SUPPORTED for f in table_schema.fields)\n# check before reading rows","typeGuard":null,"tryCatchPattern":"try:\n    row_dict = convert_row_to_dict(row, schema)\nexcept RuntimeError as e:\n    if str(e).startswith('Unexpected field type'):\n        log.warning('skipping row with unsupported field type: %s', e)\n        return None\n    raise","preventionTips":["Keep apache-beam upgraded to support new BigQuery types (JSON, RANGE, etc.).","CAST exotic types to STRING in the read query.","Compare table schema against supported types before launching a read pipeline."],"tags":["bigquery","python","type-conversion","schema"],"backgroundTag":"unsupported-dtype","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}