apache/beam · error · UnsupportedOperationException

BeamRowMapper does not have support for fields of type ${fie

Error message

BeamRowMapper does not have support for fields of type ${fieldType}

What it means

SchemaUtil.createFieldExtractor builds per-field ResultSet extractors for mapping rows into Beam Rows. The default branch throws UnsupportedOperationException when the Beam field type has no registered extractor in RESULTSET_FIELD_EXTRACTORS, i.e. BeamRowMapper cannot read that field type back from the ResultSet.

Source

Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/SchemaUtil.java:262

    };
  }

  /** Creates a {@link ResultSetFieldExtractor} for the given type. */
  private static ResultSetFieldExtractor createFieldExtractor(Schema.FieldType fieldType) {
    Schema.TypeName typeName = fieldType.getTypeName();
    switch (typeName) {
      case ARRAY:
      case ITERABLE:
        Schema.FieldType elementType = checkArgumentNotNull(fieldType.getCollectionElementType());
        ResultSetFieldExtractor elementExtractor = createFieldExtractor(elementType);
        return createArrayExtractor(elementExtractor);
      case DATETIME:
        return TIMESTAMP_EXTRACTOR;
      case LOGICAL_TYPE:
        return createLogicalTypeExtractor(checkArgumentNotNull(fieldType.getLogicalType()));
      default:
        if (!RESULTSET_FIELD_EXTRACTORS.containsKey(typeName)) {
          throw new UnsupportedOperationException(
              "BeamRowMapper does not have support for fields of type " + fieldType);
        }
        return RESULTSET_FIELD_EXTRACTORS.get(typeName);
    }
  }

  /** Creates a {@link ResultSetFieldExtractor} for array types. */
  private static ResultSetFieldExtractor createArrayExtractor(
      ResultSetFieldExtractor elementExtractor) {
    return (rs, index) -> {
      Array arrayVal = rs.getArray(index);
      if (arrayVal == null) {
        return null;
      }

      List<@Nullable Object> arrayElements = new ArrayList<>();
      ResultSet arrayRs = checkArgumentNotNull(arrayVal.getResultSet());
      while (arrayRs.next()) {

View on GitHub (pinned to 12126d8942)

Solutions

  1. Coerce the column in SQL to a supported base type (e.g. CAST(col AS VARCHAR), col::text)
  2. Upgrade Beam — extractor coverage expands across releases
  3. Use JdbcIO.read() with a custom RowMapper instead of readRows for unsupported columns
  4. Check the field type in the inferred schema and override it by writing a custom query with explicit typing

Example fix

// before
"SELECT id, geometry FROM places" // geometry has no extractor
// after
"SELECT id, ST_AsText(geometry) AS geometry FROM places" // read as STRING
Defensive patterns

Strategy: try-catch

Validate before calling

for (Schema.Field f : schema.getFields()) {
  Schema.FieldType ft = f.getType();
  if (ft.getTypeName() != Schema.TypeName.STRING && ft.getTypeName() != Schema.TypeName.INT64
      && ft.getTypeName() != Schema.TypeName.FLOAT64 && ft.getTypeName() != Schema.TypeName.BYTES
      && ft.getTypeName() != Schema.TypeName.DATETIME && ft.getTypeName() != Schema.TypeName.LOGICAL_TYPE) {
    LOG.warn("Field {} of type {} may lack a ResultSet extractor", f.getName(), ft);
  }
}

Try / catch

try {
  PCollection<Row> rows = pipeline.apply(JdbcIO.readRows()...);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("BeamRowMapper does not have support for fields of type")) {
    LOG.error("Cast the offending column in SQL or use a custom RowMapper");
  }
  throw e;
}

Prevention

When it happens

Trigger: Using JdbcIO.readRows() / BeamRowMapper on a query whose ResultSet metadata maps to a Beam FieldType without a registered extractor (e.g. certain logical types or binary/array types on drivers Beam does not map).

Common situations: Schema inference picked a logical type (e.g. from JDBC_UUID handling or OTHER_AS_STRING) that the extractor map lacks; driver returns unusual metadata types; reading columns with vendor-specific types.

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/04f596d0743b9c73. Report an issue: GitHub.