{"record":{"id":"a5a20b271a8a1606","repo":"apache/beam","slug":"null-value-at-column-bigtablerowtobeamrow","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/BigtableRowToBeamRow.java","lineNumber":149,"sourceCode":"      }\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(\n                  column -> {\n                    String columnName = column.getQualifier().toStringUtf8();\n                    return KV.of(columnName, columnToRow(column, schema));\n                  })\n              .collect(\n                  Collectors.toMap(\n                      KV::getKey,\n                      kv -> {\n                        Object value = kv.getValue();\n                        if (value == null) {\n                          throw new NullPointerException(\"Null value at column \" + kv.getKey());\n                        } else {\n                          return value;\n                        }\n                      }));\n      return Row.withSchema(schema).withFieldValues(columns).build();\n    }\n\n    private Row bigtableRowToBeamRow(com.google.bigtable.v2.Row bigtableRow) {\n      Row.FieldValueBuilder rowBuilder =\n          Row.withSchema(schema).withFieldValue(KEY, bigtableRow.getKey().toStringUtf8());\n      bigtableRow.getFamiliesList().stream()\n          .filter(family -> schema.hasField(family.getName()))\n          .forEach(\n              family -> {\n                Schema familySchema = schema.getField(family.getName()).getType().getRowSchema();\n                if (familySchema == null) {\n                  throw new NullPointerException(\n                      \"Null family schema at family \" + family.getName());","sourceCodeStart":131,"sourceCodeEnd":167,"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#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Identify the named column and compare its Bigtable cell value/qualifier type with the declared schema field type","Correct the schema field type for that column so converters can decode the cell bytes","Filter out incompatible columns in the column mapping so no null-producing column is mapped","Add a null check in custom value converters (logical types) to return a default instead of null"],"exampleFix":"// before\nschema mapping declares column 'score' as INT64 but cells are STRING bytes\n// after\ndeclare 'score' as STRING (or decode bytes as INT64 before writing)","handlingStrategy":"validation","validationCode":"Object v = columnValue;\nif (v == null) {\n  throw new IllegalArgumentException(\"Column \" + columnName + \" produced null; fix its declared field type or drop the column from the mapping\");\n}","typeGuard":"boolean isMappable(Object cellValue) { return cellValue != null; }","tryCatchPattern":"try {\n  Row r = bigtableRowToBeamRow(btRow, schema);\n} catch (NullPointerException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Null value at column \")) {\n    // inspect the named column's declared type vs its cell bytes\n  }\n  throw e;\n}","preventionTips":["Ensure declared field types match actual Bigtable cell encoding (bytes, strings, integers)","Skip logically-null columns in the column mapping rather than mapping them to required fields","Test converters against representative rows in unit tests"],"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"}