{"record":{"id":"d528a86456d7d3c7","repo":"apache/druid","slug":"can-t-read-row-memory-from-frame-wrong-type-or-si","errorCode":null,"errorMessage":"Can't read row memory from frame. Wrong type or signature?","messagePattern":"Can't read row memory from frame\\. Wrong type or signature\\?","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/KeyStatisticsCollectionProcessor.java","lineNumber":158,"sourceCode":"      final ColumnSelectorFactory columnSelectorFactory\n  )\n  {\n    final Supplier<MemoryRange<Memory>> rowMemorySupplier =\n        FrameReaderUtils.makeRowMemorySupplier(columnSelectorFactory, frameType, frameReader.signature());\n\n    final int numFields = frameReader.signature().size();\n\n    if (rowMemorySupplier == null) {\n      // Can't access row memory.\n      throw new ISE(\"Can't read row memory from frame. Wrong frame type or signature?\");\n    }\n\n    return () -> {\n      final MemoryRange<Memory> rowMemory = rowMemorySupplier.get();\n\n      if (rowMemory == null) {\n        // Can't access row memory.\n        throw new ISE(\"Can't read row memory from frame. Wrong type or signature?\");\n      }\n\n      long maxValueLength = 0;\n      long totalLength = 0;\n      long currentValueStartPosition = (long) Integer.BYTES * numFields;\n\n      for (int i = 0; i < numFields; i++) {\n        final long currentValueEndPosition = rowMemory.memory().getInt(rowMemory.start() + (long) Integer.BYTES * i);\n        final long valueLength = currentValueEndPosition - currentValueStartPosition;\n\n        if (valueLength > maxValueLength) {\n          maxValueLength = valueLength;\n        }\n\n        totalLength += valueLength;\n        currentValueStartPosition = currentValueEndPosition;\n      }\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/KeyStatisticsCollectionProcessor.java#L140-L176","documentation":"Secondary guard in the same makeRowWeightSupplier path: the per-row MemoryRange supplier returned null for a row, so row memory could not be read for that frame row (wrong frame type or signature mismatch) while accumulating cluster-by statistics. Distinct from the construction-time check — here the failure occurs per-row at read time.","triggerScenarios":"Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/KeyStatisticsCollectionProcessor.java:158 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as an engine bug: file a report including the query, stage number, and frame signature.","Verify the input frame was produced by a compatible writer version; re-run the query to rule out corrupted frames.","Avoid ORDER BY/cluster-by configurations that trigger row-memory statistics collection until fixed."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}