{"record":{"id":"2791cc642976e457","repo":"apache/druid","slug":"dim-lengths-not-equal-s-vs-s","errorCode":null,"errorMessage":"Dim lengths not equal %s vs %s","messagePattern":"Dim lengths not equal (.+?) vs (.+?)","errorType":"validation","errorClass":"SegmentValidationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/IndexIO.java","lineNumber":258,"sourceCode":"\n  private static void validateRowValues(\n      RowPointer rp1,\n      IndexableAdapter adapter1,\n      RowPointer rp2,\n      IndexableAdapter adapter2\n  )\n  {\n    if (rp1.getTimestamp() != rp2.getTimestamp()) {\n      throw new SegmentValidationException(\n          \"Timestamp mismatch. Expected %d found %d\",\n          rp1.getTimestamp(),\n          rp2.getTimestamp()\n      );\n    }\n    final List<Object> dims1 = rp1.getDimensionValuesForDebug();\n    final List<Object> dims2 = rp2.getDimensionValuesForDebug();\n    if (dims1.size() != dims2.size()) {\n      throw new SegmentValidationException(\"Dim lengths not equal %s vs %s\", dims1, dims2);\n    }\n    final List<String> dim1Names = adapter1.getDimensionNames(false);\n    final List<String> dim2Names = adapter2.getDimensionNames(false);\n    int dimCount = dims1.size();\n    for (int i = 0; i < dimCount; ++i) {\n      final String dim1Name = dim1Names.get(i);\n      final String dim2Name = dim2Names.get(i);\n\n      ColumnCapabilities capabilities1 = adapter1.getCapabilities(dim1Name);\n      ColumnCapabilities capabilities2 = adapter2.getCapabilities(dim2Name);\n      ColumnType dim1Type = capabilities1.toColumnType();\n      ColumnType dim2Type = capabilities2.toColumnType();\n      if (!Objects.equals(dim1Type, dim2Type)) {\n        throw new SegmentValidationException(\n            \"Dim [%s] types not equal. Expected %d found %d\",\n            dim1Name,\n            dim1Type,\n            dim2Type","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/IndexIO.java#L240-L276","documentation":"During IndexIO.validateRowValues, each row's dimension value list from the two segments is compared element-by-element. If the two rows have a different number of dimension values, validation fails before the per-dimension comparison can run. This signals structurally different rows, usually from segments built with different schemas or null-handling.","triggerScenarios":"Running IndexIO.validateTwoSegments on segments whose rows report different getDimensionValuesForDebug() list sizes — e.g. one segment has null/unset dimensions encoded differently than the other.","commonSituations":"Comparing segments built by different Druid versions with different default null dimension handling; validating a segment against a re-ingested copy where schema auto-discovery found extra dimensions.","solutions":["Align ingestion specs so both segments have identical dimension schemas and null handling","Re-persist the segment with the schema of the reference segment (use IndexMerger with explicit dim exclusions/convert)","Upgrade both segments to the same Druid version so null-dimension encoding matches"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"List<Object> d1 = rp1.getDimensionValuesForDebug();\nList<Object> d2 = rp2.getDimensionValuesForDebug();\nif (d1.size() != d2.size()) {\n  throw new IllegalStateException(\"Row dim counts differ: \" + d1.size() + \" vs \" + d2.size());\n}","typeGuard":null,"tryCatchPattern":"try {\n  IndexIO.validateTwoSegments(adapter1, adapter2);\n} catch (SegmentValidationException e) {\n  if (e.getMessage().startsWith(\"Dim lengths not equal\")) {\n    // schema mismatch: rebuild segment with matching schema\n  }\n}","preventionTips":["Use identical ingestion specs (dimensions + null handling) when producing compared segments","Run a SegmentMetadataQuery to confirm matching dimension schemas before validation"],"tags":["druid","segment","validation","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}