{"record":{"id":"454e6625914d2594","repo":"apache/beam","slug":"null-value-at-column","errorCode":null,"errorMessage":"Null value at column ","messagePattern":"Null value 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/BeamRowToBigtableMutation.java","lineNumber":116,"sourceCode":"      }\n    }\n\n    private Mutation mutation(String family, String column, Row row) {\n      return Mutation.newBuilder()\n          .setSetCell(\n              Mutation.SetCell.newBuilder()\n                  .setValue(convertValueToByteString(row, column))\n                  .setColumnQualifier(ByteString.copyFromUtf8(column))\n                  .setFamilyName(family)\n                  .build())\n          .build();\n    }\n\n    private ByteString convertValueToByteString(Row row, String column) {\n      Schema.Field field = row.getSchema().getField(column);\n      Object value = row.getValue(column);\n      if (value == null) {\n        throw new NullPointerException(\"Null value at column \" + column);\n      } else {\n        return cellValueParser.valueToByteString(value, field.getType());\n      }\n    }\n  }\n}\n","sourceCodeStart":98,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BeamRowToBigtableMutation.java#L98-L123","documentation":"convertValueToByteString converts a Row field's value into a ByteString for a Bigtable SetCell. Bigtable cells cannot store null values, so when row.getValue(column) is null the transform throws a NullPointerException identifying the offending column.","triggerScenarios":"A mutation is built for a column family whose mapped Row column exists in the schema but holds a null value at runtime.","commonSituations":"Sparse source records where optional columns are null; ETL pipelines writing raw rows without null-filtering; schema fields declared but not populated.","solutions":["Filter or fill nulls before the transform (e.g. setValue with a default, or Filter.by excluding rows with null target columns).","Skip null columns when building the mutation map so only populated fields become SetCell mutations.","Represent nulls as explicit sentinel values (e.g. empty ByteString or a marker) if they must be stored."],"exampleFix":"// before\nObject value = row.getValue(column); // may be null\n// after\nObject value = row.getValue(column);\nif (value == null) {\n  return ByteString.EMPTY; // or skip this column entirely\n}","handlingStrategy":"validation","validationCode":"for (String col : targetColumns) {\n  if (row.getValue(col) == null) {\n    throw new IllegalArgumentException(\"Column \" + col + \" is null; cannot write to Bigtable\");\n  }\n}","typeGuard":"boolean isStorable(Row row, String column) { return row.getValue(column) != null; }","tryCatchPattern":"try { return convertValueToByteString(row, column); } catch (NullPointerException e) { log.warn(\"Skipping null column {}\", column); return null; }","preventionTips":["Coalesce nulls to defaults before writing.","Only map non-null columns into the mutation family map.","Test the transform with sparse rows containing nulls."],"tags":["bigtable","null","cell-value"],"backgroundTag":"null-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}