{"record":{"id":"1af291a0561dea3d","repo":"apache/beam","slug":"null-row-schema-at-column","errorCode":null,"errorMessage":"Null row schema at column ","messagePattern":"Null row schema 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":125,"sourceCode":"    // Returns Simple type, List<Simple type> or Row\n    private Object columnToRow(Column column, Schema schema) {\n      String columnName = column.getQualifier().toStringUtf8();\n      Schema.FieldType columnType = schema.getField(columnName).getType();\n      List<Cell> cells = column.getCellsList();\n      switch (columnType.getTypeName()) {\n        case ARRAY:\n          Schema.FieldType collectionElementType = columnType.getCollectionElementType();\n          if (collectionElementType != null) {\n            return cells.stream()\n                .map(cell -> getCellValue(cell, collectionElementType))\n                .collect(toList());\n          } else {\n            throw new NullPointerException(\"Null collectionElementType at column \" + columnName);\n          }\n        case ROW:\n          @Nullable Schema rowSchema = columnType.getRowSchema();\n          if (rowSchema == null) {\n            throw new NullPointerException(\"Null row schema at column \" + columnName);\n          } else {\n            return cellToRow(getLastCell(cells), rowSchema);\n          }\n        default:\n          return getCellValue(getLastCell(cells), columnType);\n      }\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(","sourceCodeStart":107,"sourceCodeEnd":143,"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#L107-L143","documentation":"In BigtableRowToBeamRow.columnToRow, a column whose type declares a Row schema (nested struct) must have that nested schema available. If columnType.getRowSchema() is null, a NullPointerException('Null row schema at column <name>') is thrown. The mapping declared the column as a nested row but omitted the nested Schema.","triggerScenarios":"A Bigtable column is mapped with FieldType ROW (component type 'row' / nested struct) but no nested Schema is attached to the field type in the schema mapping.","commonSituations":"Deserialized schemas where nested row schemas were dropped, hand-built field types with Schema.FieldType.row(null)-like constructions, schema evolution/round-tripping through JSON that lost the nested schema.","solutions":["Attach the nested schema: use Schema.FieldType.row(nestedSchema) for the column","If the column is not a nested structure, map it to a scalar type instead of ROW","Rebuild the schema from the source mapping rather than reusing a serialized schema that lost nested definitions","Add a pre-flight check: assert columnType.getRowSchema() != null for all ROW-typed columns before running the pipeline"],"exampleFix":"// before\nSchema.FieldType colType = Schema.FieldType.row(null);\n// after\nSchema.FieldType colType = Schema.FieldType.row(nestedSchema);","handlingStrategy":"validation","validationCode":"if (columnType.getTypeName() == Schema.TypeName.ROW && columnType.getRowSchema() == null) {\n  throw new IllegalArgumentException(\"Column \" + columnName + \" of type ROW needs a nested schema\");\n}","typeGuard":"boolean hasRowSchema(Schema.FieldType t) {\n  return t.getTypeName() != Schema.TypeName.ROW || t.getRowSchema() != null;\n}","tryCatchPattern":null,"preventionTips":["Use Schema.FieldType.row(nestedSchema) — never build ROW types without a schema","Re-derive nested schemas from source after any schema JSON round-trip","Add a schema sanity check step at pipeline startup"],"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"}