apache/beam · error · NullPointerException
Null collectionElementType at column
Error message
Null collectionElementType at column
What it means
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.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableRowToBeamRow.java:120
rowBuilder.withFieldValue(LABELS, cell.getLabelsList());
}
return rowBuilder.build();
}
// Returns Simple type, List<Simple type> or Row
private Object columnToRow(Column column, Schema schema) {
String columnName = column.getQualifier().toStringUtf8();
Schema.FieldType columnType = schema.getField(columnName).getType();
List<Cell> cells = column.getCellsList();
switch (columnType.getTypeName()) {
case ARRAY:
Schema.FieldType collectionElementType = columnType.getCollectionElementType();
if (collectionElementType != null) {
return cells.stream()
.map(cell -> getCellValue(cell, collectionElementType))
.collect(toList());
} else {
throw new NullPointerException("Null collectionElementType at column " + columnName);
}
case ROW:
@Nullable Schema rowSchema = columnType.getRowSchema();
if (rowSchema == null) {
throw new NullPointerException("Null row schema at column " + columnName);
} else {
return cellToRow(getLastCell(cells), rowSchema);
}
default:
return getCellValue(getLastCell(cells), columnType);
}
}
private Row familyToRow(Family family, Schema schema) {
Map<String, Object> columns =
family.getColumnsList().stream()
.filter(column -> schema.hasField(column.getQualifier().toStringUtf8()))
.map(View on GitHub (pinned to 12126d8942)
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
Example fix
// before Schema.FieldType colType = Schema.FieldType.iterable(null); // after Schema.FieldType colType = Schema.FieldType.iterable(Schema.FieldType.STRING);
Defensive patterns
Strategy: validation
Validate before calling
Schema.FieldType t = columnType;
if ((t.getTypeName() == Schema.TypeName.ARRAY || t.getTypeName() == Schema.TypeName.ITERABLE)
&& t.getCollectionElementType() == null) {
throw new IllegalArgumentException("Column " + columnName + " needs a collection element type");
} Type guard
boolean hasElementType(Schema.FieldType t) {
return t.getCollectionElementType() != null;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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
- Null row schema at column
- Null value at column
- Null family schema at family
- Null column list at family
- Null value found for field that doesn't support nulls.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/e2643c1a3393bb91.
Report an issue: GitHub.