apache/beam · error · UnsupportedOperationException

Unsupported type: , consider using withCustomRecordParsing

Error message

Unsupported type: , consider using withCustomRecordParsing

What it means

CsvIOParseHelpers.parseCell() handles only scalar, string-representable field types (BOOLEAN, INTEGER, LONG, DOUBLE, FLOAT, DATETIME, etc.) and throws UnsupportedOperationException for any other FieldType (e.g. BYTES, arrays, maps, nested rows) telling you to use withCustomRecordParsing. CSV cells are plain strings, so Beam refuses to guess a serialization for complex types.

Source

Thrown at sdks/java/io/csv/src/main/java/org/apache/beam/sdk/io/csv/CsvIOParseHelpers.java:153

          return Short.parseShort(cell);
        case INT32:
          return Integer.parseInt(cell);
        case INT64:
          return Long.parseLong(cell);
        case BOOLEAN:
          return Boolean.parseBoolean(cell);
        case BYTE:
          return Byte.parseByte(cell);
        case DECIMAL:
          return new BigDecimal(cell);
        case DOUBLE:
          return Double.parseDouble(cell);
        case FLOAT:
          return Float.parseFloat(cell);
        case DATETIME:
          return Instant.parse(cell);
        default:
          throw new UnsupportedOperationException(
              "Unsupported type: " + fieldType + ", consider using withCustomRecordParsing");
      }

    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          e.getMessage() + " field " + field.getName() + " was received -- type mismatch");
    }
  }
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Register a custom parser for the field via CsvIO's withCustomRecordParsing (custom CellDeserializer for that type).
  2. Change the schema field to a supported scalar type (e.g. encode bytes as Base64 String).
  3. Flatten nested/complex data into scalar columns before CSV round-tripping.

Example fix

// before: schema field FieldType.BYTES -> UnsupportedOperationException
// after
CsvIO.read(path)
    .withCustomRecordParsing(ParsingBuilder.of(schema)
        .setCustomParser("blob", cell -> Base64.getDecoder().decode(cell))
        .build());
Defensive patterns

Strategy: validation

Validate before calling

schema.getFields().forEach(f -> {
  switch (f.getType().getTypeName()) {
    case BYTE: case INT16: case INT32: case INT64: case FLOAT: case DOUBLE:
    case STRING: case BOOLEAN: case DATETIME: break;
    default: throw new IllegalStateException("field " + f.getName() + " needs withCustomRecordParsing");
  }
});

Try / catch

try { pipeline.apply(CsvIO.read(path)); } catch (UnsupportedOperationException e) { /* register custom parser for the offending type */ }

Prevention

When it happens

Trigger: Applying CsvIO.read to a schema containing an unsupported FieldType such as BYTES, ITERABLE, MAP, or a logical/row type without registering a custom parser.

Common situations: Reusing an Avro/BigQuery-style schema with binary or nested fields directly as a CSV schema; adding a new complex column to a previously all-scalar CSV pipeline.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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