{"record":{"id":"053a645a198ddc9c","repo":"apache/beam","slug":"unexpected-type-selecthelpers","errorCode":null,"errorMessage":"Unexpected type {}","messagePattern":"Unexpected type (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectHelpers.java","lineNumber":411,"sourceCode":"                  entry.getValue(),\n                  selectValueBuilder,\n                  fieldAccessDescriptor,\n                  nestedInputType,\n                  nestedOutputType);\n\n              Row valueBeforeDistribution = selectValueBuilder.build();\n              for (int i = 0; i < nestedSchema.getFieldCount(); ++i) {\n                selectedMaps.get(i).put(entry.getKey(), valueBeforeDistribution.getValue(i));\n              }\n            }\n          }\n          for (Map aMap : selectedMaps) {\n            output.addValue(aMap);\n          }\n          break;\n        }\n      default:\n        throw new RuntimeException(\"Unexpected type \" + qualifier.getKind());\n    }\n  }\n\n  /**\n   * This policy keeps all levels of a name. Every field name in the path to a given field is\n   * concated with _ characters.\n   */\n  public static final SerializableFunction<List<String>, String> CONCAT_FIELD_NAMES =\n      l -> {\n        return String.join(\"_\", l);\n      };\n\n  /**\n   * This policy keeps the raw nested field name. If two differently-nested fields have the same\n   * name, flattening will fail with this policy.\n   */\n  public static final SerializableFunction<List<String>, String> KEEP_NESTED_NAME =\n      l -> {","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectHelpers.java#L393-L429","documentation":"selectIntoRowWithQualifiers copies values into an output row by qualifier kind; the switch over qualifier.getKind() has a default arm that throws when the kind is not one it can copy (e.g. nested ARRAY/MAP qualifiers it doesn't handle).","triggerScenarios":"Invoked from selectIntoRow when a selected field path traverses a container whose qualifier kind has no copy branch (unsupported nested collection kind during row materialization).","commonSituations":"Selecting deeply nested fields in arrays/maps where an intermediate level's type kind is not among the kinds the copier implements; typically hit after schema changes or with exotic field types.","solutions":["Rewrite the selection to avoid the unsupported nesting level (select the parent field instead of drilling into the container).","Change the schema so the field in question uses a supported kind (primitive, row, or supported list/map).","Upgrade Beam — newer versions add handling for more qualifier kinds in SelectHelpers.","Pre-transform the data into rows before the select so the path contains only row qualifiers."],"exampleFix":"// before\nRow out = SelectHelpers.selectIntoRow(row, schema, FieldAccessDescriptor.withFieldNames(\"tags[0]\")); // unsupported qualifier kind\n// after\nRow out = SelectHelpers.selectIntoRow(row, schema, FieldAccessDescriptor.withFieldNames(\"tags\"));","handlingStrategy":"validation","validationCode":"// ensure selected field paths only traverse ROW qualifiers\nfor (String path : selectedFieldNames) {\n  Schema.FieldType t = schema.getField(path).getType();\n  if (t.getTypeName() == Schema.TypeName.ARRAY || t.getTypeName() == Schema.TypeName.MAP)\n    throw new IllegalArgumentException(\"Path traverses unsupported container qualifier: \" + path);\n}","typeGuard":"boolean rowOnlyPath(Schema schema, String field) {\n  Schema.FieldType t = schema.getField(field).getType();\n  return t.getTypeName() == Schema.TypeName.ROW || t.getTypeName().isPrimitiveType();\n}","tryCatchPattern":"try {\n  return SelectHelpers.selectIntoRow(row, outSchema, descriptor);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Unexpected type\")) {\n    throw new IllegalArgumentException(\"Unsupported qualifier kind in select; simplify field path\", e);\n  }\n  throw e;\n}","preventionTips":["Model nested data as rows rather than ad-hoc containers when selecting","Select the whole container, then process in code","Pin Beam versions with known SelectHelpers coverage"],"tags":["java","schema","select","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-14T16:17:12.679Z"}