apache/beam · error · UnsupportedOperationException

SchemaUserTypeCreator not available

Error message

SchemaUserTypeCreator not available

What it means

AwsSchemaProvider.schemaTypeCreator always throws UnsupportedOperationException because AWS SDK v2 POJOs are not Beam SchemaUserTypeCreator-compatible; you cannot instantiate an SdkPojo from a Beam Row via this provider. The provider supports reading AWS objects as Rows (schema inference) but not the reverse (creating instances from Rows).

Solutions

  1. Do not use Beam Schema creation APIs to build AWS SDK POJOs; construct them with their builder classes
  2. Map the Row manually to the SdkPojo builder fields
  3. Wrap the target type in your own schema provider that implements schemaTypeCreator

Example fix

// before
MyAwsModel model = (MyAwsModel) Schema.andValues(schema, row); // hits UnsupportedOperationException
// after
MyAwsModel model = MyAwsModel.builder()
    .field1(row.getString("field1"))
    .field2(row.getInt64("field2"))
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (AwsSchemaProvider.class.equals(registry.schemaProvider(targetType))) { /* cannot use SchemaUserTypeCreator APIs on AWS POJOs */ }

Try / catch

try { return schemaRegistry.getCreator(MyAwsPojo.class); } catch (UnsupportedOperationException e) { /* build via MyAwsPojo.builder() instead */ }

Prevention

When it happens

Trigger: Registering AwsSchemaProvider in the schema registry and then calling Schema.toRow/getters pipeline APIs that require a creator for an AWS SDK SdkPojo type; using setRow/Row-construction APIs on AwsModel target types.

Common situations: Attempting to materialize AWS SDK objects (e.g. SqsMessage) from Beam Rows using Schema.andValues or toBean; enabling schema coders on AWS POJOs in a direction the provider doesn't support.

Related errors


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

Appendix: source

Thrown at sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/schemas/AwsSchemaProvider.java:219

      Set<String> unknowns = difference(newHashSet(schema.getFieldNames()), fields.keySet());
      checkState(unknowns.isEmpty(), "Row schema contains unknown fields: %s", unknowns);
    }
  }

  @Override
  public List<FieldValueTypeInformation> fieldValueTypeInformations(
      TypeDescriptor<?> targetTypeDescriptor, Schema schema) {
    List<SdkField<?>> sdkFieldList = sdkFields((Class) targetTypeDescriptor.getRawType());

    return sdkFieldList.stream()
        .map(AwsTypes::fieldValueTypeInformationFor)
        .collect(Collectors.toList());
  }

  @Override
  public SchemaUserTypeCreator schemaTypeCreator(
      TypeDescriptor<?> targetTypeDescriptor, Schema schema) {
    throw new UnsupportedOperationException("SchemaUserTypeCreator not available");
  }

  private static <T extends SdkPojo> AwsBuilderFactory<T, ?> builderFactory(Class<T> cls) {
    return FACTORIES.computeIfAbsent(cls, c -> AwsSchemaUtils.builderFactory(cls));
  }

  private static <T extends SdkPojo> List<SdkField<?>> sdkFields(Class<T> cls) {
    return builderFactory(cls).sdkFields();
  }

  private static <T extends SdkPojo> SdkBuilder<?, T> sdkBuilder(Class<T> cls) {
    return builderFactory(cls).get();
  }

  private static <T extends SdkPojo> Map<String, SdkField<?>> sdkFieldsByName(Class<T> cls) {
    return sdkFields(cls).stream().collect(toMap(AwsTypes::normalizedNameOf, identity()));
  }
}

View on GitHub (pinned to 12126d8942)