{"record":{"id":"da749a0a5b8e58fb","repo":"apache/beam","slug":"fieldtype","errorCode":null,"errorMessage":"${fieldType}","messagePattern":"\\$\\{fieldType\\}","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/providers/JavaRowUdf.java","lineNumber":343,"sourceCode":"          .put(Schema.TypeName.INT32, int.class)\n          .put(Schema.TypeName.INT64, long.class)\n          .put(Schema.TypeName.FLOAT, float.class)\n          .put(Schema.TypeName.DOUBLE, double.class)\n          .put(Schema.TypeName.BOOLEAN, boolean.class)\n          .put(Schema.TypeName.BYTES, byte[].class)\n          .put(Schema.TypeName.STRING, String.class)\n          .put(Schema.TypeName.DECIMAL, BigDecimal.class)\n          .build();\n\n  private static Type typeFromFieldType(Schema.FieldType fieldType) {\n    Map<Schema.TypeName, Type> primitivesMap =\n        fieldType.getNullable() ? NULLABLE_PRIMITIVES : NON_NULLABLE_PRIMITIVES;\n    if (primitivesMap.containsKey(fieldType.getTypeName())) {\n      return primitivesMap.get(fieldType.getTypeName());\n    } else if (fieldType.getRowSchema() != null) {\n      return Row.class;\n    } else {\n      throw new UnsupportedOperationException(fieldType.toString());\n    }\n  }\n}\n","sourceCodeStart":325,"sourceCodeEnd":347,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/providers/JavaRowUdf.java#L325-L347","documentation":"JavaRowUdf maps Schema.FieldType values to Java classes (via primitive maps or Row.class for nested rows). typeFromFieldType throws UnsupportedOperationException when it encounters a field type that is neither a known primitive/logical type nor a row with a schema — e.g. arrays, maps, or exotic logical types unsupported by the expression compiler.","triggerScenarios":"createFunctionFromExpression compiles a generated class whose generated method signature includes a parameter or return type resolved through typeFromFieldType, and the input schema contains a field of an unmapped FieldType (e.g. ARRAY, MAP, ITERABLE, or a logical type without a row schema).","commonSituations":"Applying a row UDF to a schema containing collection or map fields; using a custom logical type the primitive maps don't cover.","solutions":["Restrict the UDF input schema to primitive and row-typed fields","Flatten or explode collection fields before applying the UDF","Extend the primitive maps or handle the FieldType case upstream in your own fork","Check fieldType.getTypeName() against supported types before invoking the transform"],"exampleFix":"// before\n// schema field: tags ARRAY<STRING> passed into a row UDF\n// after\n// explode/flatten 'tags' first, or exclude it from the UDF input schema","handlingStrategy":"validation","validationCode":"for (Schema.Field f : inputSchema.getFields()) {\n  Schema.FieldType t = f.getType();\n  if (PRIMITIVES.containsKey(t.getTypeName()) || t.getRowSchema() != null)\n    throw new IllegalArgumentException(\"Unsupported UDF field type: \" + t);\n}","typeGuard":null,"tryCatchPattern":"try { createUdf(cfg); } catch (UnsupportedOperationException e) { /* fall back to DoFn-based UDF */ }","preventionTips":["Restrict UDF input schemas to primitive and row fields","Explode collections before applying row UDFs"],"tags":["java","apache-beam","udf","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}