{"record":{"id":"e2643c1a3393bb91","repo":"apache/beam","slug":"null-collectionelementtype-at-column","errorCode":null,"errorMessage":"Null collectionElementType at column ","messagePattern":"Null collectionElementType at column ","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableRowToBeamRow.java","lineNumber":120,"sourceCode":"        rowBuilder.withFieldValue(LABELS, cell.getLabelsList());\n      }\n      return rowBuilder.build();\n    }\n\n    // Returns Simple type, List<Simple type> or Row\n    private Object columnToRow(Column column, Schema schema) {\n      String columnName = column.getQualifier().toStringUtf8();\n      Schema.FieldType columnType = schema.getField(columnName).getType();\n      List<Cell> cells = column.getCellsList();\n      switch (columnType.getTypeName()) {\n        case ARRAY:\n          Schema.FieldType collectionElementType = columnType.getCollectionElementType();\n          if (collectionElementType != null) {\n            return cells.stream()\n                .map(cell -> getCellValue(cell, collectionElementType))\n                .collect(toList());\n          } else {\n            throw new NullPointerException(\"Null collectionElementType at column \" + columnName);\n          }\n        case ROW:\n          @Nullable Schema rowSchema = columnType.getRowSchema();\n          if (rowSchema == null) {\n            throw new NullPointerException(\"Null row schema at column \" + columnName);\n          } else {\n            return cellToRow(getLastCell(cells), rowSchema);\n          }\n        default:\n          return getCellValue(getLastCell(cells), columnType);\n      }\n    }\n\n    private Row familyToRow(Family family, Schema schema) {\n      Map<String, Object> columns =\n          family.getColumnsList().stream()\n              .filter(column -> schema.hasField(column.getQualifier().toStringUtf8()))\n              .map(","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableRowToBeamRow.java#L102-L138","documentation":"In BigtableRowToBeamRow.columnToRow, when a column's Schema.FieldType is declared as a collection (array/iterable), the collection element type must be present. If columnType.getCollectionElementType() returns null, a NullPointerException('Null collectionElementType at column <name>') is thrown. This means the Bigtable schema mapping declared an array/iterable cell type without specifying the element type.","triggerScenarios":"Building the BigtableRowDTOWrapper / schema with a column mapped as ARRAY or ITERABLE (component type 'array'/'iterable') but omitting its component element type in the field type definition.","commonSituations":"Hand-constructed Schema.FieldType for a Bigtable column where multiple cells per row are expected, but the developer wrote FieldType.array(...) incorrectly or built a raw collection type without components; stale serialization of schemas.","solutions":["Fix the column field type in the Bigtable schema mapping to declare the element type, e.g. Schema.FieldType.array(Schema.FieldType.STRING)","If the column is single-valued, map it as a plain type (e.g. STRING/INT64) instead of a collection","Regenerate the schema mapping instead of hand-editing serialized Schema JSON","Log/validate the schema (print Schema.FieldType) before running the pipeline to confirm collections have component types"],"exampleFix":"// before\nSchema.FieldType colType = Schema.FieldType.iterable(null);\n// after\nSchema.FieldType colType = Schema.FieldType.iterable(Schema.FieldType.STRING);","handlingStrategy":"validation","validationCode":"Schema.FieldType t = columnType;\nif ((t.getTypeName() == Schema.TypeName.ARRAY || t.getTypeName() == Schema.TypeName.ITERABLE)\n    && t.getCollectionElementType() == null) {\n  throw new IllegalArgumentException(\"Column \" + columnName + \" needs a collection element type\");\n}","typeGuard":"boolean hasElementType(Schema.FieldType t) {\n  return t.getCollectionElementType() != null;\n}","tryCatchPattern":null,"preventionTips":["Always construct collection field types with Schema.FieldType.array(elementType) / iterable(elementType)","Validate the schema mapping in a unit test before running the pipeline","Prefer the library's schema-building helpers over hand-assembled FieldTypes"],"tags":["java","bigtable","schema","null"],"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"}