apache/beam · error · RuntimeException

Parameter has no schema and the input is not a primitive typ

Error message

Parameter has no schema and the input is not a primitive type.

What it means

withUnboxPrimitiveParameter further requires the single selected field to be a primitive (non-composite) type. If the one field is itself a composite (row/map/array) type, it cannot be unboxed into a primitive DoFn parameter and a RuntimeException is thrown.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnSchemaInformation.java:137

   * single-field row with a field of the output type.
   *
   * @param inputCoder The coder for the ParDo's input elements.
   * @param selectDescriptor The descriptor describing which field to select.
   * @param selectOutputSchema The schema of the selected parameter.
   * @param elementT The type of the method's input parameter.
   * @return
   */
  DoFnSchemaInformation withUnboxPrimitiveParameter(
      SchemaCoder inputCoder,
      FieldAccessDescriptor selectDescriptor,
      Schema selectOutputSchema,
      TypeDescriptor<?> elementT) {
    if (selectOutputSchema.getFieldCount() != 1) {
      throw new RuntimeException("Parameter has no schema and the input is not a simple type.");
    }
    FieldType fieldType = selectOutputSchema.getField(0).getType();
    if (fieldType.getTypeName().isCompositeType()) {
      throw new RuntimeException("Parameter has no schema and the input is not a primitive type.");
    }

    List<SerializableFunction<?, ?>> converters =
        ImmutableList.<SerializableFunction<?, ?>>builder()
            .addAll(getElementConverters())
            .add(
                UnboxingConversionFunction.of(
                    inputCoder.getSchema(),
                    inputCoder.getToRowFunction(),
                    selectDescriptor,
                    selectOutputSchema,
                    elementT))
            .build();

    return toBuilder().setElementConverters(converters).build();
  }

  /**

View on GitHub (pinned to 12126d8942)

Solutions

  1. Select a truly primitive field (e.g. field.getInt32("count") style field, not a nested struct)
  2. Change the DoFn parameter to the composite type (Row, List, Map) matching the field type
  3. Flatten/unbox the composite field in an upstream schema transform (e.g. Select into primitive columns) before the DoFn

Example fix

// before (nested field bound to primitive param)
.select("nestedStruct") ... @ProcessElement public void process(@Element Integer v)
// after
.select("nestedStruct.someInt") ... @ProcessElement public void process(@Element Integer v)
Defensive patterns

Strategy: validation

Validate before calling

FieldType f = selectOutputSchema.getField(0).getType();
if (f.getTypeName().isCompositeType()) {
  // unbox to a primitive field upstream before binding the DoFn parameter
}

Prevention

When it happens

Trigger: A DoFn @ProcessElement parameter declared as a primitive/simple Java type while the resolved single-field schema type is composite (nested Row, list, map).

Common situations: Selecting a nested struct field and binding it to a primitive parameter; schema evolution turning a formerly primitive field into a nested type.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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