apache/beam · error · NullPointerException

Null value at column

Error message

Null value at column 

What it means

In BigtableRowToBeamRow.familyToRow, column values are collected into a map and each produced value is checked; if any column-to-row conversion returns null, a NullPointerException('Null value at column <key>') is thrown before building the Beam Row. This guards the invariant that every mapped column must produce a non-null value for the row being built.

Source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableRowToBeamRow.java:149

      }
    }

    private Row familyToRow(Family family, Schema schema) {
      Map<String, Object> columns =
          family.getColumnsList().stream()
              .filter(column -> schema.hasField(column.getQualifier().toStringUtf8()))
              .map(
                  column -> {
                    String columnName = column.getQualifier().toStringUtf8();
                    return KV.of(columnName, columnToRow(column, schema));
                  })
              .collect(
                  Collectors.toMap(
                      KV::getKey,
                      kv -> {
                        Object value = kv.getValue();
                        if (value == null) {
                          throw new NullPointerException("Null value at column " + kv.getKey());
                        } else {
                          return value;
                        }
                      }));
      return Row.withSchema(schema).withFieldValues(columns).build();
    }

    private Row bigtableRowToBeamRow(com.google.bigtable.v2.Row bigtableRow) {
      Row.FieldValueBuilder rowBuilder =
          Row.withSchema(schema).withFieldValue(KEY, bigtableRow.getKey().toStringUtf8());
      bigtableRow.getFamiliesList().stream()
          .filter(family -> schema.hasField(family.getName()))
          .forEach(
              family -> {
                Schema familySchema = schema.getField(family.getName()).getType().getRowSchema();
                if (familySchema == null) {
                  throw new NullPointerException(
                      "Null family schema at family " + family.getName());

View on GitHub (pinned to 12126d8942)

Solutions

  1. Identify the named column and compare its Bigtable cell value/qualifier type with the declared schema field type
  2. Correct the schema field type for that column so converters can decode the cell bytes
  3. Filter out incompatible columns in the column mapping so no null-producing column is mapped
  4. Add a null check in custom value converters (logical types) to return a default instead of null

Example fix

// before
schema mapping declares column 'score' as INT64 but cells are STRING bytes
// after
declare 'score' as STRING (or decode bytes as INT64 before writing)
Defensive patterns

Strategy: validation

Validate before calling

Object v = columnValue;
if (v == null) {
  throw new IllegalArgumentException("Column " + columnName + " produced null; fix its declared field type or drop the column from the mapping");
}

Type guard

boolean isMappable(Object cellValue) { return cellValue != null; }

Try / catch

try {
  Row r = bigtableRowToBeamRow(btRow, schema);
} catch (NullPointerException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Null value at column ")) {
    // inspect the named column's declared type vs its cell bytes
  }
  throw e;
}

Prevention

When it happens

Trigger: A cell converter (getCellValue / cellToRow) returns null for a column — e.g. an unrecognized/mismatched cell value type versus the declared schema field type for that column, or an empty cell list routed through a path yielding null.

Common situations: Schema declares a primitive type but the Bigtable cell bytes cannot be converted (type mismatch), a logical type converter returning null for unexpected bytes, mapping applied to a family whose cell layout doesn't match the declared schema.

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


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/a5a20b271a8a1606. Report an issue: GitHub.