apache/beam · error · IllegalArgumentException

Unable to parse field with type

Error message

Unable to parse field with type %s

What it means

Thrown by stringToParsedValue when a Spanner column value's Type has a code that the parser has no conversion branch for. Each known TypeCode (STRING, INT64, FLOAT64, BOOL, TIMESTAMP, DATE, BYTES, NUMERIC, JSON, DATETIME, DECIMAL...) is converted from its string fieldValue; anything outside the switch hits the default and raises IllegalArgumentException.

Solutions

  1. Upgrade the Beam Google Cloud Platform connector to a version whose stringToParsedValue handles your column's type code.
  2. Identify the offending type from the message and change the column type in Spanner to a supported one (e.g. NUMERIC vs DECIMAL dialect differences).
  3. If on a PG-dialect database, check known dialect limitations of the Spanner change stream connector and convert types accordingly.
  4. As a last resort, exclude the unsupported column from the queried columns so it never reaches the parser.
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("STRING","INT64","FLOAT64","BOOL","TIMESTAMP","DATE","BYTES","NUMERIC","JSON","DATETIME","DECIMAL");
if (!supported.contains(fieldType.getCode().name())) { /* skip or transform column */ }

Try / catch

try { row = stringToParsedValue(fieldValue, fieldType); } catch (IllegalArgumentException e) { log.warn("Unsupported type {}", fieldType, e); return null; }

Prevention

When it happens

Trigger: A change stream record contains a column whose Spanner TypeCode is not among the handled cases (e.g. a newly added Spanner type, or PG-g dialect type codes) when mapping values into a Beam row.

Common situations: Using PostgreSQL-dialect Spanner databases whose type codes differ from GoogleSQL; Spanner introducing a new TypeCode not yet supported by the Beam connector version in use; schema changes adding exotic column types to a tracked table.

Understand the failure class

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/7bce6952e37b3451. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangestreamsReadSchemaTransformProvider.java:407

      case INT64:
        return Long.valueOf(fieldValue);
      case INT16:
      case INT32:
        return Integer.valueOf(fieldValue);
      case FLOAT:
        return Float.parseFloat(fieldValue);
      case DOUBLE:
        return Double.parseDouble(fieldValue);
      case BOOLEAN:
        return Boolean.parseBoolean(fieldValue);
      case BYTES:
        return fieldValue.getBytes(StandardCharsets.UTF_8);
      case DATETIME:
        return new DateTime(fieldValue);
      case DECIMAL:
        return new BigDecimal(fieldValue);
      default:
        throw new IllegalArgumentException(
            String.format("Unable to parse field with type %s", fieldType));
    }
  }

  private static Schema.FieldType spannerTypeToBeamType(Type spannerType) {
    switch (spannerType.getCode()) {
      case BOOL:
        return Schema.FieldType.BOOLEAN;
      case BYTES:
        return Schema.FieldType.BYTES;
      case STRING:
        return Schema.FieldType.STRING;
      case INT64:
        return Schema.FieldType.INT64;
      case NUMERIC:
        return Schema.FieldType.DECIMAL;
      case FLOAT64:
        return Schema.FieldType.DOUBLE;

View on GitHub (pinned to 12126d8942)