{"record":{"id":"7b2b70d8a9dd92c7","repo":"apache/beam","slug":"null-family-schema-at-family","errorCode":null,"errorMessage":"Null family schema at family ","messagePattern":"Null family schema at family ","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":166,"sourceCode":"                        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());\n                } else {\n                  rowBuilder.withFieldValue(family.getName(), familyToRow(family, familySchema));\n                }\n              });\n      return rowBuilder.build();\n    }\n  }\n}\n","sourceCodeStart":148,"sourceCodeEnd":176,"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#L148-L176","documentation":"In BigtableRowToBeamRow.bigtableRowToBeamRow, each Bigtable family present in the row and in the target schema must map to a nested row; schema.getField(family).getType().getRowSchema() returning null means the family field was declared without a nested row schema. A NullPointerException('Null family schema at family <name>') is thrown. The schema declares the family as a struct type but omits its fields.","triggerScenarios":"Building the row schema with a field per Bigtable family using Schema.FieldType.row(...) without attaching the family's nested Schema, then reading rows from that family.","commonSituations":"Schema constructed programmatically where the family field type is ROW but getRowSchema() was never set, schema round-tripped through serialization losing nested schemas, mapping mismatch between writer schema and reader schema versions.","solutions":["Attach the family's nested schema when building the field: Schema.FieldType.row(familySchema)","Verify the schema used in bigtableRowToBeamRow matches the one created by the schema-building helpers (BigtableRowToBeamRow.getSchema/buildBigtableRowSchema)","Reconstruct the schema rather than deserializing a possibly-truncated one","Add validation: for each family field, assert getType().getRowSchema() != null before starting the read"],"exampleFix":"// before\nfields.add(Field.of(familyName, Schema.FieldType.row(null)));\n// after\nfields.add(Field.of(familyName, Schema.FieldType.row(familySchema)));","handlingStrategy":"validation","validationCode":"for (Field f : schema.getFields()) {\n  if (f.getType().getTypeName() == Schema.TypeName.ROW && f.getType().getRowSchema() == null) {\n    throw new IllegalArgumentException(\"Family field \" + f.getName() + \" missing nested row schema\");\n  }\n}","typeGuard":"boolean hasFamilySchema(Schema schema, String family) {\n  return schema.getField(family).getType().getRowSchema() != null;\n}","tryCatchPattern":null,"preventionTips":["Build family schemas with the library helpers so nested schemas are always attached","Keep reader schema in sync with writer schema versions","Validate every ROW-typed field has getRowSchema() != null before reads"],"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"}