{"record":{"id":"fd72812b347a2f97","repo":"apache/beam","slug":"parameter-has-no-schema-and-the-input-is-not-a-primitive","errorCode":null,"errorMessage":"Parameter has no schema and the input is not a primitive type.","messagePattern":"Parameter has no schema and the input is not a primitive type\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnSchemaInformation.java","lineNumber":137,"sourceCode":"   * single-field row with a field of the output type.\n   *\n   * @param inputCoder The coder for the ParDo's input elements.\n   * @param selectDescriptor The descriptor describing which field to select.\n   * @param selectOutputSchema The schema of the selected parameter.\n   * @param elementT The type of the method's input parameter.\n   * @return\n   */\n  DoFnSchemaInformation withUnboxPrimitiveParameter(\n      SchemaCoder inputCoder,\n      FieldAccessDescriptor selectDescriptor,\n      Schema selectOutputSchema,\n      TypeDescriptor<?> elementT) {\n    if (selectOutputSchema.getFieldCount() != 1) {\n      throw new RuntimeException(\"Parameter has no schema and the input is not a simple type.\");\n    }\n    FieldType fieldType = selectOutputSchema.getField(0).getType();\n    if (fieldType.getTypeName().isCompositeType()) {\n      throw new RuntimeException(\"Parameter has no schema and the input is not a primitive type.\");\n    }\n\n    List<SerializableFunction<?, ?>> converters =\n        ImmutableList.<SerializableFunction<?, ?>>builder()\n            .addAll(getElementConverters())\n            .add(\n                UnboxingConversionFunction.of(\n                    inputCoder.getSchema(),\n                    inputCoder.getToRowFunction(),\n                    selectDescriptor,\n                    selectOutputSchema,\n                    elementT))\n            .build();\n\n    return toBuilder().setElementConverters(converters).build();\n  }\n\n  /**","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnSchemaInformation.java#L119-L155","documentation":"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.","triggerScenarios":"A DoFn @ProcessElement parameter declared as a primitive/simple Java type while the resolved single-field schema type is composite (nested Row, list, map).","commonSituations":"Selecting a nested struct field and binding it to a primitive parameter; schema evolution turning a formerly primitive field into a nested type.","solutions":["Select a truly primitive field (e.g. field.getInt32(\"count\") style field, not a nested struct)","Change the DoFn parameter to the composite type (Row, List, Map) matching the field type","Flatten/unbox the composite field in an upstream schema transform (e.g. Select into primitive columns) before the DoFn"],"exampleFix":"// before (nested field bound to primitive param)\n.select(\"nestedStruct\") ... @ProcessElement public void process(@Element Integer v)\n// after\n.select(\"nestedStruct.someInt\") ... @ProcessElement public void process(@Element Integer v)","handlingStrategy":"validation","validationCode":"FieldType f = selectOutputSchema.getField(0).getType();\nif (f.getTypeName().isCompositeType()) {\n  // unbox to a primitive field upstream before binding the DoFn parameter\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Select primitive leaf fields (e.g. struct.intField) when unboxing","Avoid schema changes that convert primitive fields to nested types without updating DoFn signatures"],"tags":["apache-beam","java","schema","dofn"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}